Registry / database / tmap-mysql

tmap-mysql

JSON →
library1.0.10jsnpmunverified

MySQL Data Access Layer wrapper for TradeMap4You projects, version 1.0.10. Provides connection pooling, parameterized queries, bulk insert from JSON, and pool management. Built on mysql2, supports up to 1000 concurrent users with UTF-8 (utf8mb4) support. A lightweight internal tool not intended for general use.

npm install tmap-mysql
INSTALL
IMPORT
SIG · TMAP-MYSQL
T
tmap-mysql
databasejavascriptv1.0.10
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.

default
✓ const MySqlDO = require('tmap-mysql');
✗ import MySqlDO from 'tmap-mysql';
Package is CommonJS only; no ESM export or TypeScript types.
MySqlDO
✓ const repo = new (require('tmap-mysql'))(connectionString);
✗ const repo = new MySqlDO();
Constructor requires a connection string argument; no default.
executeQuery
✓ const { executeQuery } = require('tmap-mysql');
✗ const executeQuery = require('tmap-mysql').executeQuery;
executeQuery is a method on the instance, not a static export. The correct import is the default class.
connectionString
✓ const repo = new MySqlDO('mysql://user:pass@host:3306/db');
✗ const repo = new MySqlDO({ host: 'localhost' });
Expects a single string, not an object. Use MySQL connection URL format.

Shows creating a repository with connection string, executing parameterized query, getting table data, inserting a row, checking pool status, and closing pool.

const MySqlDO = require('tmap-mysql'); const config = require('./config'); const dataRepo = new MySqlDO(config.mysqlConString); async function main() { try { const users = await dataRepo.executeQuery('SELECT * FROM users WHERE id = ?', [1]); console.log('User:', users); const allUsers = await dataRepo.getTableData('users'); console.log('All users:', allUsers); const newUser = await dataRepo.InsertRowFromData('users', { name: 'John', email: 'john@example.com' }); console.log('Inserted:', newUser); const poolStatus = dataRepo.getPoolStatus(); console.log('Pool:', poolStatus); } finally { await dataRepo.closePool(); } } main().catch(console.error);
Debug
Known issues
gotchaConstructor expects a single connection string (MySQL URL), not a config object. Passing an object will cause a TypeError.
fix
Provide a string like 'mysql://user:pass@host:3306/db'.
affects: >=1.0.0
gotchaPackage is CommonJS-only; no ESM exports. Using 'import' will fail.
fix
Use require() instead of import.
affects: >=1.0.0
gotchaNo TypeScript type definitions. Using TypeScript will require manual declaration or 'any' cast.
fix
Create a .d.ts file or use @ts-ignore.
affects: >=1.0.0
breakingclosePool() must be called on application shutdown to release database connections. Failing to do so may exhaust connection limits.
fix
Call await dataRepo.closePool() in process exit handlers (e.g., process.on('SIGINT')).
affects: >=1.0.0
deprecatedgetQueryResult() is a raw query method; use executeQuery() with parameterized queries instead to prevent SQL injection.
fix
Replace getQueryResult(query) with executeQuery(query, params) and supply parameters.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: MySqlDO is not a constructor
Using wrong import style (e.g., import instead of require) or forgetting 'new'.
fix
const MySqlDO = require('tmap-mysql'); const repo = new MySqlDO(connectionString);
Error: Cannot find module 'tmap-mysql'
Package not installed or not linked.
fix
Run 'npm install tmap-mysql' or 'npm link tmap-mysql' in your project.
Error: getaddrinfo ENOTFOUND
Connection string host is incorrect or database server is not reachable.
fix
Verify the MySQL host, port, and network connectivity. Use correct format: mysql://user:pass@host:3306/db.
Error: ER_ACCESS_DENIED_ERROR: Access denied for user
Invalid username or password in connection string.
fix
Check credentials in connection string. Ensure user has proper privileges.
Upgrade
Version history
1.0.10latest on npm
Audit
Dependencies
mysql2requiredUnderlying MySQL driver for all database operations
Agent activity
15 hits · last 30 days
node
14
OpenAI (training)
1
Resources
tmap-mysql — npm install tmap-mysql · libregistry