
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
@eugabrielsilva/rapidsql
Advanced tools
A very simple and easy to use promise-based MySQL wrapper for Node.js
A very simple and easy to use promise-based MySQL wrapper for Node.js.
npm install @eugabrielsilva/rapidsql
const rapidSQL = require('@eugabrielsilva/rapidsql');
const db = new rapidSQL({host: DB_HOST, user: DB_USER, password: DB_PASSWORD, database: DB_DATABASE});
Provide the connection options as an object in the database constructor. Valid options are:
host
(optional): The hostname of the database you are connecting to. (Defaults to localhost
)user
(optional): The MySQL user to authenticate as. (Defaults to root
)password
(optional): The password of that MySQL user. (Defaults to empty)database
(required): Name of the database to use for this connection.port
(optional): The port number to connect to. (Defaults to 3306
)connectionLimit
(optional): The maximum number of connections to create at once. (Defaults to 10
)stringifyObjects
(optional): Stringify objects instead of converting to values. (Defaults to false
)debug
(optional): Prints protocol details to STDOUT
. (Defaults to false
)This library uses connection pools as default. You only need to connect to the database once. The connection is made asynchronously.
db.connect().then(() => {
console.log('Successfully connected!');
}).catch((err) => {
console.log(err);
});
You can run SQL queries by using the sql()
method. All queries are made asynchronously and will respond with a result object or an array of objects.
db.sql('SELECT * FROM table_name').then((result) => {
console.log(result);
}).catch((err) => {
console.log(err);
});
In order to avoid SQL Injection attacks, you should always escape any user provided data before using it inside a SQL query. You can do this by using ?
characters as placeholders for values you would like to have escaped like this:
let userID = 5;
db.sql('SELECT * FROM users WHERE ID = ?', [userID]).then((result) => {
console.log(result);
}).catch((err) => {
console.log(err);
});
Multiple placeholders are mapped to values in the same order as passed. For example, in the following query foo
equals a
, bar
equals b
, baz
equals c
, and ID
will be userID
:
let userID = 5;
db.sql('UPDATE users SET foo = ?, bar = ?, baz = ? WHERE ID = ?', ['a', 'b', 'c', userID]).then((result) => {
console.log(result);
}).catch((err) => {
console.log(err);
});
If you are not going to use the connection anymore, you can close it by using the close()
method. This method will wait until all pending queries are executed.
db.close().then(() => {
console.log('Successfully disconnected!');
}).catch((err) => {
console.log(err);
});
Library developed and currently maintained by Gabriel Silva.
FAQs
A very simple and easy to use promise-based MySQL wrapper for Node.js
The npm package @eugabrielsilva/rapidsql receives a total of 0 weekly downloads. As such, @eugabrielsilva/rapidsql popularity was classified as not popular.
We found that @eugabrielsilva/rapidsql 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
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.