I am beginning to get a handle on CodeIgniter and discovered it's support for that Active Record pattern.

I love the truth that it creates the SQL code for you personally so basically you are able to retrieve, update and place data in a database without tying the application to some specific database engine.

It can make simple queries quite simple but my concern is it makes complex queries more complicated otherwise impossible (e.g. if requirement for engine specific functions).

My Questions

Whatrrrs your opinion of the pattern especially regarding CodeIgniters implementation?

What are the speed difficulties with wrapping the database in another layer?

Will it (logic) become untidy when attempting to construct very complex queries?

Perform the advantages out way the disadvantages?

Ok, To begin with 99% of the queries is going to be simple choose/place/update/remove. With this active record is excellent. It offers simple syntax that may be easily transformed. For additional complex queries you need to only use the query method. Thats what its for.

Second, It offers getting away &lifier to safeguard individuals queries. Face the facts, the application most likely may have 100s otherwise 1000's of places where queries occur. Your certain to ruin and end up forgetting to correctly escape a number of them. Active record doesn't forget.

Third, performance in my opinion isn't significantly affected. Obviously it's nevertheless its most likely around .00001 per query. I believe that's perfectly appropriate for the additional security and sanity inspections it will for you personally.

Lastly, I believe its obvious which i believe the benefits are far more than the disadvantages. Getting secure queries that even your most junior developer can understand and never ruin is a superb factor.