OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How can I debug queries sent via mysql2?

  • Thread starter Thread starter Yanick Rochon
  • Start date Start date
Y

Yanick Rochon

Guest
From the mysql2 readme we read :

MySQL2 is mostly API compatible with mysqljs

Which package has an option defined as :

  • debug: Prints protocol details to stdout. Can be true/false or an array of packet type names that should be printed. (Default: false)

This option even has an example :

Code:
var connection = mysql.createConnection({debug: ['ComQueryPacket', 'RowDataPacket']});

However, setting this option with either true, "ComQueryPacket" and/or "RowDataPacket" vomits a ton load of irrelevant data; all I care is to have the SQL query and variables being sent. How can this be done with this package?

<p>From the <a href="https://www.npmjs.com/package/mysql2" rel="nofollow noreferrer">mysql2</a> readme we read :</p>
<blockquote>
<p>MySQL2 is mostly API compatible with
<a href="https://github.com/mysqljs/mysql" rel="nofollow noreferrer">mysqljs</a></p>
</blockquote>
<p>Which package has an option defined as :</p>
<blockquote>
<ul>
<li><strong>debug</strong>: Prints protocol details to stdout. Can be true/false or an array of packet type names that should be printed. (Default: false)</li>
</ul>
</blockquote>
<p>This option even has an example :</p>
<pre><code>var connection = mysql.createConnection({debug: ['ComQueryPacket', 'RowDataPacket']});
</code></pre>
<p>However, setting this option with either <code>true</code>, <code>"ComQueryPacket"</code> and/or <code>"RowDataPacket"</code> vomits a ton load of irrelevant data; all I care is to have the SQL query and variables being sent. How can this be done with this package?</p>
 

Latest posts

Top