So why do some frameworks (like CakePHP, Kohana, Zend, Djago, less - Rails) create some type of SQL abstractions rather than a raw SQL database access? E.g. so why do we have to have perversions rather than a usual queries?
UPD: what are the SQL-injection reasons of the purpose?
Essentially a great abstraction layer causes it to be simpler for that developer to utilize a database, and never care what what and which type of database he's hooking up to, thus accelerating the expansion process.
Take a look at http://en.wikipedia.org/wiki/Database_abstraction_layer, the most typical benefits and drawbacks are right here.
Thats known as abstraction. Usually its completed to be db specific indipendent. Sql is going to be built in line with the db kind of the bond..
You will find two primary reasons.
- Database Indepence
The code does apply to various databases. MySQL, MS SQL-SERVER, ORACLE. And after some wrangling with other DBs using OBDC like MSAccess, or CSV files.
- Separation of Database Code with Business Logic
Most frameworks follow this model: http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller
It's mainly an effort to lessen what is known as the impedance mismatch between your relational storage from the database and also the domain model in your application. With no ORM you frequently end up writing "left hands right hands" code
modelobject.property = reader["field] where you are mapping values in the storage format you've received in the database to your model.
To sum up, hopefully the ORM enables you to focus on fixing the company problems without needing to be worried about all the plumbing. We are not there yet but we are getting close.