Question

I'm trying to get to grips with Kohana framework for a new project. I just wanted to ask what your thoughts were on the two different methods for executing queries. Does one method pose any limitations?

http://kohanaframework.org/guide/tutorials.databases 1. Prepared Statements 2. Query Building

I want to make the right decision before I start building the app.

Many thanks!

Was it helpful?

Solution

Both have their own machnism to escape the user input. I prefer the Query Builder, because I think it is easier to read later on. But that is just a matter of taste. Both are the same and will have the same limitations.

Offtopic: Have a look at the ORM that comes with Kohana 3. It is really easy and works like a charm. I only use the query builder for complex queries.

OTHER TIPS

Prepared Statements are useful when you cant build query with a QBuilder (DB engine-specific commands, like 'UNLOCK TABLES'). For all standard queries (select/insert/update/delete) I recommend you QBuilder.

If you can write SQL, then write it. The query builder is for people that can't write SQL. Using the ORM is a different story, thats all by preference. I love to write all my queries manually, makes it easier for me to test against the database manually.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top