title: How to view db queries generated by TableGateway in Zend Framework 2
body: <p>I am brand new to ZF2 and am trying to use a tableGateway to manage and update entries in a database. I am able to select and update items without a problem, but when inserting I get an error. Since the tableGateway class creates the query on the fly, how can I see the query itself?</p>
  
  <pre><code>$this-&gt;tableGateway-&gt;insert($data);
  </code></pre>
  
  <p>An error occurred during execution; please try again later.
  Additional information:
  Zend\Db\Adapter\Exception\InvalidQueryException</p>
  
  <p>File:</p>
  
  <pre><code>/[redacted]/vendor/zendframework/zendframework/library/Zend/Db/Adapter/Driver/Pdo/Statement.php:220
  </code></pre>
  
  <p>Message:</p>
  
  <pre><code>Statement could not be executed
  </code></pre>