Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
better-sqlite-pool
Advanced tools
Readme
A connection pool for the module better-sqlite3.
Using this module to open pools and acquire connections, and release
the
connection once it has done its work.
NOTE: Since v0.3.1, this package no longer includes better-sqlite3 by default, you have to install it explicitly.
npm i better-sqlite3 better-sqlite-pool
const { Pool } = require("better-sqlite-pool");
// Create a new pool:
var pool = new Pool("./example.db");
// use Promise:
pool.acquire().then(db => {
var res = db.prepare("select * from users where id = 1").get();
console.log(res);
db.release();
});
// use async/await:
(async function() {
var db = await pool.acquire();
var res = db.prepare("select * from users where id = 2").get();
console.log(res);
db.release();
})();
setImmediate(() => {
console.log(pool);
});
new Pool(path: string, options:? object|boolean|number)
Creates a new pool to store database connections.
path
A SQLite database file path, can be set to :memory
to open a memory
based database.[options]
May contain any of these:
readonly
Default is false
.memory
Default is false
.fileMustExist
Default is false
.max
Max connections in the pool, default is 5
.timeout
The number of milliseconds to wait when executing queries on a
locked database, before throwing a SQLITE_BUSY error. Also, this option
is used to determine how long it'd be waited before throwing timeout
error when acquiring the connection. (default: 5000).verbose
A function that gets called with every SQL string executed by
the database connection (default: null
).boolean
, it's equivalent to readonly
,
if set to a number, it's equivalent to max
.pool.acquire(): Promise<BetterSqlite3.Database>
Acquires a connection from the pool.
pool.close()
Closes all connections in the pool.
node-gyp
errorIf you have any problem of downloading and installing this module, it's most
likely that you're running an old version Node.js which doesn't include prebuilt
better-sqlite3 binary files, and don't have a node-gyp
installed, which is
used to compile better-sqlite3. so please install node-gyp
first if this
situation occurs to you.
VCBulid.exe
errorAnother problem you may face is your computer throwing an error that tells you
the VCBulid.exe
file is missing. This is probably you don't have a Visual
Studio installed, install one with VC++ support, that will fix the problem.
statement may fall through
errorsThese error may happen when compiling better-sqlite3 (version under v7.0) with GCC 7+, which is issued in Many "statement may fall through" while installing #3 and Ignore compilation warnings from SQLite3 itself #239, you can still run the driver though, if it's not so much important, just leave the error alone.
FAQs
A connection pool for better-sqlite3.
The npm package better-sqlite-pool receives a total of 217 weekly downloads. As such, better-sqlite-pool popularity was classified as not popular.
We found that better-sqlite-pool demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.