Socket
Socket
Sign inDemoInstall

node-firebird

Package Overview
Dependencies
2
Maintainers
3
Versions
68
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.1.0

33

lib/index.d.ts

@@ -54,2 +54,33 @@ // Type definitions for node-firebird

export type SupportedCharacterSet = |
'NONE' |
'CP943C' |
'DOS737' |
'DOS775' |
'DOS858' |
'DOS862' |
'DOS864' |
'DOS866' |
'DOS869' |
'GB18030' |
'GBK' |
'ISO8859_2' |
'ISO8859_3' |
'ISO8859_4' |
'ISO8859_5' |
'ISO8859_6' |
'ISO8859_7' |
'ISO8859_8' |
'ISO8859_9' |
'ISO8859_13' |
'KOI8R' |
'KOI8U' |
'TIS620' |
'UTF8' |
'WIN1255' |
'WIN1256' |
'WIN1257' |
'WIN1258' |
'WIN_1258';
export interface Options {

@@ -65,2 +96,4 @@ host?: string;

retryConnectionInterval?: number;
encoding?: SupportedCharacterSet;
blobAsText?: boolean; // only affects for blob subtype 1
}

@@ -67,0 +100,0 @@

2

package.json
{
"name": "node-firebird",
"version": "1.0.0",
"version": "1.1.0",
"description": "Pure JavaScript and Asynchronous Firebird client for Node.js.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -71,2 +71,3 @@ # Pure JavaScript and Asynchronous Firebird client for Node.js

options.retryConnectionInterval = 1000; // reconnect interval in case of connection drop
options.blobAsText = false; // set to true to get blob as text, only affects blob subtype 1
```

@@ -227,2 +228,69 @@

### Reading Multiples Blobs (Asynchronous)
```js
Firebird.attach(options, (err, db) => {
if (err)
throw err;
db.transaction(Firebird.ISOLATION_READ_COMMITED, (err, transaction) => {
if (err) {
throw err;
}
transaction.query('SELECT FIRST 10 * FROM JOB', (err, result) => {
if (err) {
transaction.rollback();
return;
}
const arrBlob = [];
for (const item of result) {
const fields = Object.keys(item);
for (const key of fields) {
if (typeof item[key] === 'function') {
item[key] = new Promise((resolve, reject) => {
// the same transaction is used (better performance)
// this is optional
item[key](transaction, (error, name, event, row) => {
if (error) {
return reject(error);
}
// reading data
let value = '';
event.on('data', (chunk) => {
value += chunk.toString('binary');
});
event.on('end', () => {
resolve({ value, column: name, row });
});
});
});
arrBlob.push(item[key]);
}
}
}
Promise.all(arrBlob).then((blobs) => {
for (const blob of blobs) {
result[blob.row][blob.column] = blob.value;
}
transaction.commit((err) => {
if (err) {
transaction.rollback();
return;
}
db.detach();
console.log(result);
});
}).catch((err) => {
transaction.rollback();
});
});
});
});
```
### Streaming a big data

@@ -229,0 +297,0 @@

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc