Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Build query with Query Builder but do not execute
  • Is it possible to build the query with the query builder, without executing the query? To make it more clear, let's say I have:
    $q = DB::select()->from('products');
    

    Now I want the resulting query, in this case:
    SELECT * FROM `products`
    

    But I don't want the DB Class to execute the query and get all the products. Why not? When I have the exact query, I can check in the APC cache if this database query has already been executed and if so, it gets the results from the APC cache, not from the database. If not, the query executes and its results will be saved as:
    Cache::set(md5(DB::last_query()), $data_from_db));
    
  • Found it by searching in the core... compile() is the function I need.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion