Registry / database / fc-sql

fc-sql

JSON →
library0.43.0jsnpmunverified

A simple SQL framework for Node.js currently at version 0.43.0. Provides a lightweight, promise-based abstraction over raw SQL execution with classes for CRUD operations (SQLAdder, SQLSearcher, SQLModifier, SQLRemover), transaction management, and bulk inserts. Ships TypeScript definitions. Primarily designed for server-side use with MySQL/MariaDB. Release cadence is irregular. Lacks built-in connection pooling or ORM mapping, making it a thin wrapper for developers who prefer direct SQL control with minimal overhead.

npm install fc-sql
INSTALL
IMPORT
SIG · FC-SQL
F
fc-sql
databasejavascriptv0.43.0
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.

FCDatabase
import { FCDatabase } from 'fc-sql'
const FCDatabase = require('fc-sql')
ESM-only; CommonJS require is unsupported. Use dynamic import for CJS.
SQLAdder
import { SQLAdder } from 'fc-sql'
import SQLAdder from 'fc-sql'
Named export, not default.
Transaction
import { Transaction } from 'fc-sql'
Also a named export. Use with async/await.
SQLSearcher
import { SQLSearcher } from 'fc-sql'
const SQLSearcher = require('fc-sql').SQLSearcher
CJS require is unreliable; use ESM import.

Creates a database connection, performs a parameterized SELECT query, and logs results.

import { FCDatabase, SQLSearcher } from 'fc-sql'; const db = new FCDatabase({ host: process.env.DB_HOST ?? 'localhost', port: parseInt(process.env.DB_PORT ?? '3306'), user: process.env.DB_USER ?? 'root', password: process.env.DB_PASS ?? '', database: process.env.DB_NAME ?? 'test', }); async function query() { try { await db.connect(); const searcher = new SQLSearcher(db); searcher.setTableName('users'); searcher.setFields('id, name, email'); searcher.setWhere('age > ?', [18]); const rows = await searcher.queryList(); console.log('Users:', rows); await db.close(); } catch (err) { console.error(err); } } query();
Debug
Known issues
gotchaAll methods are async and return Promises; missing await leads to undefined behavior.
fix
Ensure all database operations use await or .then().
affects: >=0.0.0
gotchaFCDatabase does not support connection pooling; one instance per connection.
fix
For multi-query applications, manage connection lifecycle manually or use a pool wrapper.
affects: >=0.0.0
gotchaSQLSearcher.setWhere uses positional parameters (?), not named parameters.
fix
Pass parameters as array in second argument; do not interpolate values into SQL string.
affects: >=0.0.0
gotchaBulk operations (SQLBulkAdder) have a default batch size that may cause memory issues with large datasets.
fix
Set batchSize explicitly when constructing SQLBulkAdder.
affects: >=0.0.0
Errors
Common errors & fixes
Cannot find module 'fc-sql'
Package not installed or import path incorrect.
fix
Run npm install fc-sql and ensure import uses named exports.
TypeError: db.connect is not a function
FCDatabase instance created without proper configuration or import mismatch.
fix
Check that FCDatabase is imported correctly and constructor parameters are provided.
Error: ER_PARSE_ERROR: You have an error in your SQL syntax
SQL syntax error in setWhere or manual query.
fix
Verify SQL string and that parameters are passed as array to parameterized methods.
Upgrade
Version history
0.43.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
packagefc-sql
fc-sql — npm install fc-sql · libregistry