Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@soulobby/mariadb
Advanced tools
Fast mariadb or mysql connector that exports typed pool methods.
Non-blocking MariaDB and MySQL client for Node.js.
MariaDB and MySQL client, 100% JavaScript, with TypeScript definition, with the Promise API.
See promise documentation for detailed API.
Callback documentation describe the callback wrapper for compatibility with existing drivers.
See dedicated part for migration from mysql/mysql2 or from 2.x version.
While there are existing MySQL clients that work with MariaDB, (such as the mysql
and mysql2
clients), the MariaDB Node.js Connector offers new functionality, like Insert Streaming, Pipelining, ed25519 plugin authentication while making no compromises on performance.
Connector is production grade quality, with multiple features:
see some of those features:
Using a Readable stream in your application, you can stream INSERT
statements to MariaDB through the Connector.
https.get('https://someContent', readableStream => {
//readableStream implement Readable, driver will stream data to database
connection.query("INSERT INTO myTable VALUE (?)", [readableStream]);
});
With Pipelining, the Connector sends commands without waiting for server results, preserving order. For instance, consider the use of executing two INSERT
statements.
The Connector doesn't wait for query results before sending the next INSERT
statement. Instead, it sends queries one after the other, avoiding much of the network latency.
For more information, see the Pipelining documentation.
Some use cases require a large amount of data to be inserted into a database table. By using batch processing, these queries can be sent to the database in one call, thus improving performance.
For more information, see the Batch documentation.
MariaDB provides benchmarks comparing the Connector with other Node.js MariaDB/MySQL clients, including:
promise-mysql
version 5.2.0 + mysql
version 2.18.1mysql2
version 2.3.3See the Benchmarks page for multiple results.
select 20 * int, 20 * varchar(32)
mysql : 3,086 ops/s ± 0.6%
mysql2 : 2,799.6 ops/s ± 1.6% ( -9.3% )
mariadb : 4,710.8 ops/s ± 1% ( +52.7% )
select 20 * int, 20 * varchar(32) using execute
mysql2 : 2,998 ops/s ± 1.3%
mariadb : 4,419.6 ops/s ± 1% ( +47.4% )
The MariaDB Connector is available through the Node.js repositories. You can install it using npm :
$ npm install mariadb
example:
const mariadb = require('mariadb');
const pool = mariadb.createPool({host: process.env.DB_HOST, user: process.env.DB_USER, connectionLimit: 5});
async function asyncFunction() {
let conn;
try {
conn = await pool.getConnection();
const rows = await conn.query("SELECT 1 as val");
// rows: [ {val: 1}, meta: ... ]
const res = await conn.query("INSERT INTO myTable value (?, ?)", [1, "mariadb"]);
// res: { affectedRows: 1, insertId: 1, warningStatus: 0 }
} finally {
if (conn) conn.release(); //release to pool
}
}
If you would like to contribute to the MariaDB Node.js Connector, please follow the instructions given in the Developers Guide.
To file an issue or follow the development, see JIRA.
FAQs
Fast mariadb or mysql connector that exports typed pool methods.
The npm package @soulobby/mariadb receives a total of 0 weekly downloads. As such, @soulobby/mariadb popularity was classified as not popular.
We found that @soulobby/mariadb 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.