
Security News
Feross on TBPN: How North Korea Hijacked Axios
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.
This is a simple yet powerful asynchronous wrapper on top of mysql package. This package always creates a connection pool and operations can either be performed directly against the pool or by retrieving a connection against which multiple consecutive operations can be executed, typically as a transaction.
const mysqlPoolFactory = require('tr-mysql');
var db;
async function init() {
db = await mysqlPoolFactory({ debug: true,
connectionLimit: 10,
host: '127.0.0.1',
user: 'dbuser',
password: 'passwordfordbuser',
database: 'sdhs' });
}
async function do_something_simple() {
var r = await db.q('SELECT * FROM test WHERE a=?', [42]);
return r;
}
async function do_something_complex() {
var c, r = [];
try {
c = await db.c();
await db.q(c, 'BEGIN');
r.push(await db.q('SELECT x FROM test WHERE a=?', [42]));
if (r[0].result.length < 1) {
throw new Error('Did not find what I was looking for');
}
r.push(await db.q('SELECT y FROM test2 WHERE b=?', [r[0].result[0].x]));
if (r[1].result.length != 1) {
throw new Error('Did not find exactly what I was looking for');
}
r.push(await db.q('UPDATE test3 SET c=? WHERE x=?', [r[0].result[0].x, r[1].result[0].y]));
r.push(await db.q('UPDATE test4 SET b=? WHERE x=?', [r[0].result[0].x 0 r[1].result[0].y], 99));
if (r[3].result.affectedRows < 1) {
throw new Error('Really expected something to have been updated');
}
await db.q(c, 'COMMIT');
c.release();
c = undefined;
} catch (e) {
if (c) {
c.destroy();
c = undefined;
}
throw e;
}
return r; // Let's return everything.
}
Timo J. Rinne tri@iki.fi
MIT License
FAQs
Simple yet powerful asynchronous MySQL wrapper
We found that tr-mysql demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.

Security News
OpenSSF has issued a high-severity advisory warning open source developers of an active Slack-based campaign using impersonation to deliver malware.

Research
/Security News
Malicious packages published to npm, PyPI, Go Modules, crates.io, and Packagist impersonate developer tooling to fetch staged malware, steal credentials and wallets, and enable remote access.