node-firebird
Advanced tools
Comparing version 0.8.10 to 0.9.0
@@ -126,7 +126,20 @@ | ||
BlrWriter.prototype.addBuffer = function (b) { | ||
this.addSmall(b.length); | ||
this.ensure(b.length); | ||
b.copy(this.buffer, this.pos); | ||
this.pos += b.length; | ||
BlrWriter.prototype.addMultiblockPart = function (c, s, encoding) { | ||
var buff = Buffer.from(s, encoding); | ||
var remaining = buff.length; | ||
var step = 0; | ||
while (remaining > 0) { | ||
var toWrite = Math.min(remaining, 254); | ||
this.addByte(c); | ||
this.addByte(toWrite + 1); | ||
this.addByte(step); | ||
buff.copy(this.buffer, this.pos, step * 254, (step * 254) + toWrite); | ||
step++; | ||
remaining -= toWrite; | ||
this.pos += toWrite; | ||
} | ||
}; | ||
@@ -311,2 +324,16 @@ | ||
XdrWriter.prototype.addBuffer = function(buffer) { | ||
this.ensure(buffer.length); | ||
buffer.copy(this.buffer, this.pos, 0, buffer.length); | ||
this.pos += buffer.length; | ||
} | ||
XdrWriter.prototype.addAlignment = function(len) { | ||
var alen = (4 - len) & 3; | ||
this.ensure(alen); | ||
this.buffer.write('ffffff', this.pos, alen, 'hex'); | ||
this.pos += alen; | ||
} | ||
/*************************************** | ||
@@ -379,3 +406,3 @@ * | ||
XdrReader.prototype.readBuffer = function (len) { | ||
XdrReader.prototype.readBuffer = function(len, toAlign = true) { | ||
if (!arguments.length) | ||
@@ -388,7 +415,7 @@ len = this.readInt(); | ||
var r = this.buffer.slice(this.pos, this.pos + len); | ||
this.pos += align(len); | ||
this.pos += toAlign ? align(len) : len; | ||
return r; | ||
}; | ||
XdrReader.prototype.readString = function (encoding) { | ||
XdrReader.prototype.readString = function(encoding) { | ||
var len = this.readInt(); | ||
@@ -398,3 +425,3 @@ return this.readText(len, encoding); | ||
XdrReader.prototype.readText = function (len, encoding) { | ||
XdrReader.prototype.readText = function(len, encoding) { | ||
if (len <= 0) | ||
@@ -407,1 +434,73 @@ return ''; | ||
}; | ||
/*************************************** | ||
* | ||
* BitSet | ||
* | ||
***************************************/ | ||
var WORD_LOG = 5; | ||
var BUFFER_BITS = 8; | ||
var BIT_ON = 1; | ||
var BIT_OFF = 0; | ||
var BitSet = exports.BitSet = function(buffer) { | ||
this.data = []; | ||
if (buffer) { | ||
this.scale(buffer.length * BUFFER_BITS); | ||
for (var i = 0; i < buffer.length; i++) { | ||
var n = buffer[i]; | ||
for (var j = 0; j < BUFFER_BITS; j++) { | ||
var k = i * BUFFER_BITS + j; | ||
this.data[k >>> WORD_LOG] |= (n >> j & BIT_ON) << k; | ||
} | ||
} | ||
} | ||
}; | ||
BitSet.prototype.scale = function(index) { | ||
var l = index >>> WORD_LOG; | ||
for (var i = this.data.length; l >= i; l--) { | ||
this.data.push(BIT_OFF); | ||
} | ||
}; | ||
BitSet.prototype.set = function(index, value) { | ||
this.scale(index); | ||
if (value === undefined || value) { | ||
this.data[index >>> WORD_LOG] |= (1 << index); | ||
} else { | ||
this.data[index >>> WORD_LOG] &= ~(1 << index); | ||
} | ||
}; | ||
BitSet.prototype.get = function(index) { | ||
var n = index >>> WORD_LOG; | ||
if (n >= this.data.length) { | ||
return BIT_OFF; | ||
} | ||
return (this.data[n] >>> index) & BIT_ON; | ||
}; | ||
BitSet.prototype.toBuffer = function() { | ||
var buf = [], int32, tmp; | ||
for (var i = 0; i < this.data.length; i += BUFFER_BITS) { | ||
tmp = this.data.slice(i, i + BUFFER_BITS); | ||
int32 = 0; | ||
for (var k = 0; k < tmp.length; k++) { | ||
int32 = (int32 * 2) + tmp[k]; | ||
} | ||
buf.push(int32); | ||
} | ||
return Buffer.from(buf) | ||
}; |
{ | ||
"name": "node-firebird", | ||
"version": "0.8.10", | ||
"version": "0.9.0", | ||
"description": "Pure JavaScript and Asynchronous Firebird client for Node.js.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -0,1 +1,3 @@ | ||
# Pure JavaScript and Asynchronous Firebird client for Node.js | ||
![Firebird Logo](https://firebirdsql.org/file/about/firebird-logo-90.png) | ||
@@ -6,8 +8,7 @@ | ||
[![NPM](https://nodei.co/npm/node-firebird.png?downloads=true&downloadRank=true)](https://nodei.co/npm/node-firebird/) [![NPM](https://nodei.co/npm-dl/node-firebird.png?months=6&height=3)](https://nodei.co/npm/node-firebird/) | ||
# Pure JavaScript Firebird client for Node.js. | ||
[![NPM](https://nodei.co/npm/node-firebird.png?downloads=true&downloadRank=true)](https://nodei.co/npm/node-firebird/) | ||
Pure JavaScript and Asynchronous Firebird client for Node.js. [Firebird forum](https://groups.google.com/forum/#!forum/node-firebird) on Google Groups. | ||
[Firebird forum](https://groups.google.com/forum/#!forum/node-firebird) on Google Groups. | ||
__Firebird database on social networks__ | ||
## Firebird database on social networks__ | ||
@@ -17,3 +18,3 @@ - [Firebird on Twitter](https://twitter.com/firebirdsql/) | ||
__Changelog for version v0.2.x__ | ||
## Changelog for version v0.2.x__ | ||
@@ -30,3 +31,2 @@ - added auto-reconnect | ||
--- | ||
@@ -350,3 +350,5 @@ | ||
``` | ||
### Service Manager functions | ||
- backup | ||
@@ -446,3 +448,4 @@ - restore | ||
### getLog and getFbserverInfos Service examples with use of stream and object return | ||
``` | ||
```js | ||
fb.attach(_connection, function(err, svc) { | ||
@@ -498,2 +501,3 @@ if (err) | ||
for Firebird 3.0 you need to add the following in firebird.conf | ||
``` | ||
@@ -503,2 +507,3 @@ AuthServer = Legacy_Auth | ||
``` | ||
## Contributors | ||
@@ -505,0 +510,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
364405
11
4658
514
1