KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Echo query from SQL statement #82

Open bysystem opened this topic on on Aug 19, 2017 - 3 comments

bysystem commented on Aug 19, 2017

Dear all,

does anybody have a hint for me how I can display the SQL statement (like echo query;) to verify how the query looks like during the run time?

Example:

    $this->src("sales")->query("
        SELECT month,sum(sale)
        FROM tbl_sales
        WHERE month IN (:month)
        GROUP BY sale
    ")->pipe($this->dataStore('month-of-year'));
}

I tried following things but without success: echo query; echo query(); echo $this->src("sales")->query ...

Any hint?

KoolReport commented on Aug 19, 2017

A hacking way is to go the line 127 of PdoDataSource.php

$query = $this->bindParams($this->query,$this->params); //Looking for this line
echo ($query); //Try to test your query.
bysystem commented on Aug 21, 2017

Thx a lot! It woks fine!

tee commented on Jan 3, 2018

Hi support team,

How if i want to store particular SQL statement into session since i run echo ($query) will result multiple SQL statements? Currently i am using Codeigniter. Thanks.

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
solved

None