On 2011-08-09 15:07, Robert McGinley wrote:
I think a better model to follow would be SQL alchemy which allows you to test the tables
or "declaratively" set columns as attributes of the model.
You mean that the columns of a table should be declared as attributes of
the corresponding class? Hmm, I don't know, I like that Rails way.
Rob
Sent from my iPad
On Aug 9, 2011, at 8:32 AM, Jacob Carlborg<d...@me.com> wrote:
On 2011-08-09 14:19, Jacob Carlborg wrote:
On 2011-08-09 09:30, Jonas Drewsen wrote:
Just stumbled upon this db orm for c++ that uses the gcc frontend to
rewrite c++ code to make classes suitable for database access.
http://www.codesynthesis.com/products/odb/
They are using pragmas to accomplish this. I guess an equally good
implementation in D would use custom attributes for this once (if) they
are supported.
/Jonas
I'm pretty sure you can create an ORM library like that with what we
already have in D today. If needed, mixins can be used like custom
attributes, but it will look very ugly.
I can also add that I think D can do a lot better job than C++ with this ODB
library. I think it would be possible to do this:
class Person : Model {}
And let the super class get all info from the database, just like ActiveRecord
in Ruby on Rails.
--
/Jacob Carlborg
--
/Jacob Carlborg