Forums / Developer / Manual SQL?

Manual SQL?

Author Message

Deane Barker

Tuesday 23 November 2004 2:15:21 pm

I have a fairly gut-wrenching content fetch I need to perform. In SQL terms, it's a three-table recursive join (that is if the content was all in one table, which it isn't...).

I think this query is far beyond the capabilities of the "fetch" function. I don't suppose there's anyway I can process a manual SQL query on the database and get the results back as if I did a fetch?

I basically want to do a fetch, but I want to supply the SQL for it.

Deane

Lazaro Ferreira

Tuesday 23 November 2004 10:44:19 pm

Hi,

AFAIK, the standard way to do it, is creating an extension in PHP, there you could call ezpublish API to fetch your data

if you want to handle directly the SQL, you can take a look a kernel/classes/ezcontentobjecttreenode.php it has the methods used by EZP itself to fecth list, subtree ,etc

Also turning sqldebug setting on (look for it at ezp site.ini) could be a good ideia to make easier to you understand ezp queries

You can also work at a higher level using the ezp php interface to templates ( .tpl code ). This is implemented at content/ezcontentfunctioncollection.php , the advantage of using this classes, is that you won't have to managed all of ezp complexity, there you take language and permission support for free, in the other hand some complex queries could't be done there directly

In conclusion, if you have created you our own databases tables, you will have to program the queries to your data manually (I don't know of any other way),

if you aren't creating any database table of your own, then you don't necessarily need to program SQL queries directly, at least that you were looking for some complex query (i.e: filtering by attributes in more than one content class object at the same time)

Lazaro
http://www.mzbusiness.com

Deane Barker

Wednesday 24 November 2004 2:11:36 am

Lazaro:

Good information, and enough for me to get a start in the right direction. Thank you for your help.

Deane