PHQL or Raw SQL

Guys what to use PHQL or Raw SQL? (your recommendation)



81.8k

PHQL and Raw SQL are the same in about 90%. If you need to use a custom syntax or custom SQL extensions you must use Raw SQL, in the remaining cases, PHQL will play better with your OO application, providing more security, automatic escaping of reserved words, dynamic renaming of columns, transparent migration to other database systems, extensibility and ease of maintenance. In fact, the entire framework is designed to work with PHQL.