[std.database]

Jacob Carlborg doob at me.com
Wed Oct 12 09:57:01 PDT 2011


On 2011-10-12 16:33, Regan Heath wrote:
> FWIW I'm with Andrei on this one. At the very least one of the proposed
> layers should allow direct/explicit SQL. That said, in my experience
> there are differences between SQL server 2000, 2005, and 2008, and also
> differences when you go via ODBC which mean some queries work and others
> fail. In which case it would be enormously convenient to have a layer
> where "someone smart" has already figured out how to do thing X with
> each type of database, and the rest of us can just call methodX() to
> make use of it. But, I reckon that layer can easily be built on top of a
> direct SQL layer, or a direct MYSQL layer, etc.

As I've said in other posts, the ORM API would be the highest level. It 
would still be possible to access the middle layer which executes raw 
SQL and the lower driver level which is specific to each database. The 
ORM layer would be built on top of the middle layer. The middle level 
would be built on top of the lower driver level.

With ActiveRecord you can execute raw SQL using:

User.connection.execute("sql")

Yeah, it's really nice to have an API that can figure out these little 
differences between the different SQL implementation and make it work 
across many databases.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list