Registry / database / blockbase-mysql

blockbase-mysql

JSON →
library1.0.4jsnpmunverified

MySQL driver for the Blockbase framework, version 1.0.4. Provides ORM-like model methods (read, save, update, delete) and raw query execution with connection pooling. Tightly integrated with Blockbase's dependency injection: accessed via app.drivers.mysql or automatically bound to models. Requires the npm mysql package. Maintenance cadence is low; last release stable. Differentiator: seamless integration with Blockbase's MVC structure, but tightly coupled and not usable standalone without the framework.

npm install blockbase-mysql
INSTALL
IMPORT
SIG · BLOCKBASE-MYSQL
B
blockbase-mysql
databasejavascriptv1.0.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

mysql driver instance
✓ const mysql = app.drivers.mysql
✗ const mysql = require('blockbase-mysql')
The driver is not imported directly; it is available through the Blockbase app instance after configuration.
mysql.execute
✓ await mysql.execute(query, params)
✗ await mysql.query(query, params)
Use execute() method, not query(). The driver exposes execute() for raw queries.
model client
✓ await this.client.execute(q, [])
✗ await this.execute(q, [])
Inside a model, the database client is accessible via this.client, not directly on the model.

Shows configuration for MySQL driver and basic usage of raw query execution within a Blockbase controller.

// config/production.yml dbms: mysql mysql: host: localhost user: myuser password: mypass port: 3306 database: mydb // myController.js module.exports = (app) => { const mysql = app.drivers.mysql; return { async listUsers(req, res) { try { const rows = await mysql.execute('SELECT * FROM users', []); res.json(rows); } catch (e) { res.status(500).send({error: e.message}); } } }; };
Debug
Known issues
gotchaDriver only works within Blockbase framework; cannot be used standalone without the full app context.
fix
Use the driver via app.drivers.mysql after properly initializing Blockbase with configuration. Do not require directly.
affects: all
breakingBreaking change in version 1.0.0: Changed from callback-based API to promise-based API with async/await.
fix
Update code to use async/await and .execute() instead of .query() callbacks.
affects: >=1.0.0 <2.0.0
gotchaInside models, the database client is this.client, not this.mysql or direct import.
fix
Use this.client.execute() to run queries within a model class extending Blockbase's Model.
affects: all
deprecatedThe old method .query() is deprecated; use .execute() instead.
fix
Replace all .query() calls with .execute().
affects: >=1.0.0
breakingThe driver no longer supports synchronous mode; all operations are async.
fix
Add async/await or .then() to all database calls.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: mysql.execute is not a function
Using require('blockbase-mysql') directly instead of via app.drivers.mysql.
fix
Access the driver through the Blockbase app instance: const mysql = app.drivers.mysql;
Cannot find module 'blockbase-mysql'
The package is not installed or not in node_modules, or the framework loader cannot locate it.
fix
Run npm install blockbase-mysql and ensure the Blockbase framework is properly initialized with the driver configuration.
Error: connect ECONNREFUSED 127.0.0.1:3306
MySQL server not running or wrong host/port in configuration.
fix
Start MySQL server or update the mysql configuration in your Blockbase config file.
Upgrade
Version history
1.0.4latest on npm
Audit
Dependencies
mysqlrequiredCore database driver; wraps the popular mysql npm package
Agent activity
15 hits · last 30 days
node
14
OpenAI (training)
1
Resources
blockbase-mysql — npm install blockbase-mysql · libregistry