Yii Framework Forum: Cdbcriteria Vs Querybuilder - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Cdbcriteria Vs Querybuilder databases compatibility Rate Topic: -----

#1 User is offline   Michaël 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 20-November 12

Posted 13 January 2013 - 05:49 PM

Hello,

I have to make some filters, such as get persons who are in a given departement, and I was wondering about the best way to do it.

I espacially would like to know about the databases compatibility. I mean if tommorow I change from MySQL to SQLite, would my requests still run?

I found that about Query Builder:

It offers certain degree of DB abstraction, which simplifies migration to different DB platforms.


Is it the same for the CDbCriteria objects? Is it better?

If anyone knows a bit more about this subject, you're welcom.

Thanks you

Have a nice day :)

Michaël S.
0

#2 User is offline   softark 

  • Keep It Simple
  • Yii
  • Group: Moderators
  • Posts: 2,041
  • Joined: 16-February 11
  • Location:Japan

Posted 13 January 2013 - 09:56 PM

Hi Michaël,

Yii uses PDO (PHP Data Objects) to handle database access. Both DAO (using query builder) and AR (using db criteria) rely on PDO. And the differences between DBMSs (e.g. MySQL and SQLite) are handled in the level of PDO ... to a certain degree. :) It is possible to write a db-specific code using PDO (and using DAO or AR).

As a practical consequence, I think there's not so much difference between DAO and AR regarding this. If we avoid db-specific SQL syntaxes in our code, it will run on any DBMS that supports PDO.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users