Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
node-firebird
Advanced tools
Pure JavaScript and Asynchronous Firebird client for Node.js.
To get help, join [this] 2 google group.
If you are new to Firebird you will find useful documentation [here] 1.
npm install node-firebird
fb = require("node-firebird");
fb.attach(
{
host: '127.0.0.1',
database: 'database.fdb',
user: 'SYSDBA',
password: 'masterkey'
},
function(err, db){
if (err) {
console.log(err.message);
} else {
database = db;
console.log("connected");
}
}
);
database.query("select cast(? as integer) from rdb$database", 123,
function (err, result) {
console.log(result)
}
);
The transaction automatically started, commited or rollbacked.
function checkError(err) {
if (err) {
throw new Error(err.message)
}
}
function check(tr, callback){
return function(err, param) {
if (!err) {
callback(err, param);
} else {
tr.rollback();
throw new Error(err.message)
}
}
}
database.startTransaction(
function(err, transaction) {
checkError(err);
transaction.query("select cast(? as integer) from rdb$database", 123,
check(transaction, function(err, result1) {
transaction.query("select cast(? as integer) from rdb$database", 456,
check(transaction, function(err, result2) {
transaction.commit(
function(err) {
checkError(err);
console.log(result1[0]);
console.log(result2[0]);
}
)
})
);
})
);
}
)
The common usage is to fetch records as objects
database.query(...)
You can also fetch records as arrays
database.execute(...)
In this case you can retrieve fields name in the callback
function(err, rows, fields){...}
You can do the same on transactions.
To quit the event loop you can do
database.detach();
This is a typical error object:
{
status: [
{gdscode: 335544569}, // Dynamic SQL Error
{gdscode: 335544436, params: [-104]}, // SQL error code = -104
{gdscode: 335544634, params: [1,31]}, // Token unknown - line 1, column 31
{gdscode: 335544382, params: ["m"]} // m
],
sqlcode: -104,
message: "Dynamic SQL Error, SQL error code = -104, Token unknown - line 1, column 31, m"
}
node-firebird doesn't let you chose the charset connection, it will always use UTF8. Node is unicode, no matter if your database is using another charset to store string or blob, Firebird will transliterate automatically.
This is why you should use Firebird 2.5 server at least.
FAQs
Pure JavaScript and Asynchronous Firebird client for Node.js.
The npm package node-firebird receives a total of 5,367 weekly downloads. As such, node-firebird popularity was classified as popular.
We found that node-firebird demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers 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
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.