return query as zend string

1

I have the following code where I need to save $ error_itens the complete query with the parameters to analyze what is happening, my question is, how do I show this query?

$sql = new Sql($this->adapter);
                $query = $sql->insert('reg_c170');
                $query->values($prod);
                $erro_itens = $queryAqui; // preciso ver a query
                $myitens = fopen("./data/log/".date('Y-m-d')."-itens-add.log", "a+");
                fwrite($myitens, $erro_itens."\r\n");
                fclose($myitens);
    
asked by anonymous 16.06.2016 / 05:59

2 answers

-1

I think you can use:

$query->getSqlString($this->dbAdapter->getPlatform());

Starting from the principle that you are inside a ZendDbSql

Reference

    
21.07.2016 / 20:10
-1
$sql = $select->getSqlString();

Being $select is object(Zend\Db\Sql\Select)[421]

    
04.08.2016 / 14:44