Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
@ladc/mysql2-adapter
Advanced tools
Connect to MySQL and MariaDB with the LADC API ('mysql2' connector).
LADC is a common API on top of relational database (SQL) connectors. It can connect to Postgresql, MariaDB / MySQL, SQLite. The API is inspired from PDO and JDBC. It’s named LADC for “a Layer Above Database Connectors”.
This package is a plugin for LADC. It is an adapter for MySQL and MariaDB, using the connector mysql2.
npm install @ladc/mysql2-adapter ladc
How to create a connection:
import ladc from "ladc";
import mysql2Adapter from "@ladc/mysql2-adapter";
const cn = ladc({
adapter: mysql2Adapter({
mysql2Config: {
host: "-my-server-",
database: "-my-database-",
user: "-my-user-",
password: "-my-password-",
},
}),
});
Add the dependencies for SQL Bricks:
npm install sql-bricks @ladc/sql-bricks-modifier
In your code, MySQL requires to set a specific placeholder
option in SQL Bricks:
import ladc from "ladc";
import mysql2Adapter from "@ladc/mysql2-adapter";
import sqlBricksModifier from "@ladc/sql-bricks-modifier";
const cn = ladc({
adapter: mysql2Adapter({
mysql2Config: {
host: "-my-server-",
database: "-my-database-",
user: "-my-user-",
password: "-my-password-",
},
}),
modifier: sqlBricksModifier({
toParamsOptions: { placeholder: "?" }, // ← Specific to MySQL
}),
});
Now, use it:
import { select } from "sql-bricks";
async function test(cn) {
const q = select("col1, col2").from("table1");
const rows = await cn.all(q);
console.log(rows);
}
With VS Code, our recommanded plugin is:
ms-vscode.vscode-typescript-tslint-plugin
)FAQs
Connect to MySQL and MariaDB with the LADC API ('mysql2' connector).
We found that @ladc/mysql2-adapter 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
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.