문제

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!

도움이 되었습니까?

해결책

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.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top