node-firebird 0.9.6 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/node.js.yml +78 -0
- package/README.md +45 -8
- package/lib/gdscodes.d.ts +1524 -0
- package/lib/gdscodes.js +1531 -0
- package/lib/index.d.ts +218 -16
- package/lib/index.js +298 -105
- package/lib/messages.js +1 -1
- package/lib/serialize.js +13 -19
- package/lib/srp.js +281 -0
- package/package.json +2 -1
- package/.github/workflows/npmpublish.yml +0 -47
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on: [push, pull_request]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
build:
|
|
7
|
+
runs-on: ${{ matrix.os }}
|
|
8
|
+
|
|
9
|
+
strategy:
|
|
10
|
+
matrix:
|
|
11
|
+
os: [ubuntu-16.04, ubuntu-18.04, windows-2019, macos-10.15]
|
|
12
|
+
node-version: [10.x, 12.x, 14.x, 15.x]
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v1
|
|
16
|
+
with:
|
|
17
|
+
fetch-depth: 10
|
|
18
|
+
|
|
19
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
20
|
+
uses: actions/setup-node@v1
|
|
21
|
+
with:
|
|
22
|
+
node-version: ${{ matrix.node-version }}
|
|
23
|
+
|
|
24
|
+
- name: Firebird install (Linux)
|
|
25
|
+
if: matrix.os == 'ubuntu-16.04' || matrix.os == 'ubuntu-18.04'
|
|
26
|
+
run: |
|
|
27
|
+
if [ `lsb_release -rs` = '16.04' ]
|
|
28
|
+
then
|
|
29
|
+
sudo apt-get install libtommath0
|
|
30
|
+
else
|
|
31
|
+
sudo apt-get install libtommath1
|
|
32
|
+
sudo ln -s /usr/lib/x86_64-linux-gnu/libtommath.so.1 /usr/lib/x86_64-linux-gnu/libtommath.so.0
|
|
33
|
+
fi
|
|
34
|
+
wget -nv -O Firebird-3.0.7.33374-0.amd64.tar.gz "https://github.com/FirebirdSQL/firebird/releases/download/R3_0_7/Firebird-3.0.7.33374-0.amd64.tar.gz"
|
|
35
|
+
tar xzvf Firebird-3.0.7.33374-0.amd64.tar.gz
|
|
36
|
+
(cd Firebird-3.0.7.33374-0.amd64; sudo ./install.sh -silent)
|
|
37
|
+
sudo usermod -a -G firebird `whoami`
|
|
38
|
+
|
|
39
|
+
- name: Firebird install (MacOS)
|
|
40
|
+
if: matrix.os == 'macos-10.15'
|
|
41
|
+
run: |
|
|
42
|
+
wget -nv -O Firebird-3.0.7-33374-x86_64.pkg "https://github.com/FirebirdSQL/firebird/releases/download/R3_0_7/Firebird-3.0.7-33374-x86_64.pkg"
|
|
43
|
+
sudo installer -verbose -pkg "Firebird-3.0.7-33374-x86_64.pkg" -target /
|
|
44
|
+
|
|
45
|
+
- name: Firebird install (Windows)
|
|
46
|
+
if: matrix.os == 'windows-2019'
|
|
47
|
+
shell: cmd
|
|
48
|
+
run: |
|
|
49
|
+
set FB_ZIP=Firebird-3.0.7.33374-1_x64.zip
|
|
50
|
+
powershell Invoke-WebRequest "https://github.com/FirebirdSQL/firebird/releases/download/R3_0_7/$env:FB_ZIP" -OutFile "$env:FB_ZIP"
|
|
51
|
+
7z x -oC:\Firebird %FB_ZIP%
|
|
52
|
+
|
|
53
|
+
- name: Build
|
|
54
|
+
shell: bash
|
|
55
|
+
run: |
|
|
56
|
+
npm ci
|
|
57
|
+
|
|
58
|
+
- name: Test (Linux)
|
|
59
|
+
if: matrix.os == 'ubuntu-16.04' || matrix.os == 'ubuntu-18.04'
|
|
60
|
+
run: |
|
|
61
|
+
sg firebird -c "npx nyc npm test"
|
|
62
|
+
|
|
63
|
+
- name: Test (MacOS)
|
|
64
|
+
if: matrix.os == 'macos-10.15'
|
|
65
|
+
run: |
|
|
66
|
+
sudo mkdir `pwd`/tmp-node-fb
|
|
67
|
+
sudo chmod 777 `pwd`/tmp-node-fb
|
|
68
|
+
export ISC_USER=sysdba
|
|
69
|
+
export ISC_PASSWORD=masterkey
|
|
70
|
+
export NODE_FB_TEST_TMP_DIR=`pwd`/tmp-node-fb
|
|
71
|
+
npx nyc npm test
|
|
72
|
+
|
|
73
|
+
- name: Test (Windows)
|
|
74
|
+
if: matrix.os == 'windows-2019'
|
|
75
|
+
shell: cmd
|
|
76
|
+
run: |
|
|
77
|
+
set PATH=C:\Firebird;%PATH%
|
|
78
|
+
call npx nyc npm test
|
package/README.md
CHANGED
|
@@ -49,7 +49,7 @@ var Firebird = require('node-firebird');
|
|
|
49
49
|
- `Firebird.attach(options, function(err, db))` attach a database
|
|
50
50
|
- `Firebird.create(options, function(err, db))` create a database
|
|
51
51
|
- `Firebird.attachOrCreate(options, function(err, db))` attach or create database
|
|
52
|
-
- `Firebird.pool(max, options
|
|
52
|
+
- `Firebird.pool(max, options) -> return {Object}` create a connection pooling
|
|
53
53
|
|
|
54
54
|
## Connection types
|
|
55
55
|
|
|
@@ -66,7 +66,8 @@ options.password = 'masterkey';
|
|
|
66
66
|
options.lowercase_keys = false; // set to true to lowercase keys
|
|
67
67
|
options.role = null; // default
|
|
68
68
|
options.pageSize = 4096; // default when creating database
|
|
69
|
-
|
|
69
|
+
options.pageSize = 4096; // default when creating database
|
|
70
|
+
options.retryConnectionInterval = 1000; // reconnect interval in case of connection drop
|
|
70
71
|
```
|
|
71
72
|
|
|
72
73
|
### Classic
|
|
@@ -183,7 +184,7 @@ Firebird.attach(options, function(err, db) {
|
|
|
183
184
|
});
|
|
184
185
|
```
|
|
185
186
|
|
|
186
|
-
### Reading Blobs (
|
|
187
|
+
### Reading Blobs (Asynchronous)
|
|
187
188
|
|
|
188
189
|
```js
|
|
189
190
|
Firebird.attach(options, function(err, db) {
|
|
@@ -345,6 +346,24 @@ console.log(sql3);
|
|
|
345
346
|
console.log(sql4);
|
|
346
347
|
```
|
|
347
348
|
|
|
349
|
+
### Using GDS codes
|
|
350
|
+
|
|
351
|
+
```js
|
|
352
|
+
var { GDSCode } = require('node-firebird/lib/gdscodes');
|
|
353
|
+
/*...*/
|
|
354
|
+
db.query('insert into my_table(id, name) values (?, ?)', [1, 'John Doe'],
|
|
355
|
+
function (err) {
|
|
356
|
+
if(err.gdscode == GDSCode.UNIQUE_KEY_VIOLATION){
|
|
357
|
+
console.log('constraint name:'+ err.gdsparams[0]);
|
|
358
|
+
console.log('table name:'+ err.gdsparams[0]);
|
|
359
|
+
/*...*/
|
|
360
|
+
}
|
|
361
|
+
/*...*/
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
|
|
348
367
|
### Service Manager functions
|
|
349
368
|
|
|
350
369
|
- backup
|
|
@@ -402,7 +421,7 @@ var fbsvc = {
|
|
|
402
421
|
### Backup Service example
|
|
403
422
|
|
|
404
423
|
```js
|
|
405
|
-
|
|
424
|
+
const options = {...}; // Classic configuration with manager = true
|
|
406
425
|
Firebird.attach(options, function(err, svc) {
|
|
407
426
|
if (err)
|
|
408
427
|
return;
|
|
@@ -417,14 +436,17 @@ Firebird.attach(options, function(err, svc) {
|
|
|
417
436
|
]
|
|
418
437
|
},
|
|
419
438
|
function(err, data) {
|
|
420
|
-
console.log(
|
|
421
|
-
|
|
439
|
+
data.on('data', line => console.log(line));
|
|
440
|
+
data.on('end', () => svc.detach());
|
|
441
|
+
}
|
|
442
|
+
);
|
|
443
|
+
});
|
|
422
444
|
```
|
|
423
445
|
|
|
424
446
|
### Restore Service example
|
|
425
447
|
|
|
426
448
|
```js
|
|
427
|
-
const config = {...}; //
|
|
449
|
+
const config = {...}; // Classic configuration with manager = true
|
|
428
450
|
const RESTORE_OPTS = {
|
|
429
451
|
database: 'database.fdb',
|
|
430
452
|
files: ['backup.fbk']
|
|
@@ -492,7 +514,7 @@ This is why you should use **Firebird 2.5** server at least.
|
|
|
492
514
|
### Firebird 3.0 Support
|
|
493
515
|
|
|
494
516
|
Firebird new wire protocol is not supported yet so
|
|
495
|
-
for Firebird 3.0 you need to add the following in firebird.conf according to Firebird
|
|
517
|
+
for Firebird 3.0 you need to add the following in firebird.conf according to Firebird 3 release notes
|
|
496
518
|
<https://firebirdsql.org/file/documentation/release_notes/html/en/3_0/rnfb30-security-new-authentication.html>
|
|
497
519
|
|
|
498
520
|
```bash
|
|
@@ -501,6 +523,21 @@ WireCrypt = Disabled
|
|
|
501
523
|
UserManager = Legacy_UserManager
|
|
502
524
|
```
|
|
503
525
|
|
|
526
|
+
Firebird 4 wire protocol is not supported yet so
|
|
527
|
+
for Firebird 4.0 you need to add the following in firebird.conf according to Firebird release notes
|
|
528
|
+
<https://firebirdsql.org/file/documentation/release_notes/html/en/4_0/rlsnotes40.html#rnfb40-config-srp256>
|
|
529
|
+
|
|
530
|
+
```bash
|
|
531
|
+
AuthServer = Srp256, Srp, Legacy_Auth
|
|
532
|
+
WireCrypt = Disabled
|
|
533
|
+
UserManager = Legacy_UserManager
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
Please read also Authorization with Firebird 2.5 client library from Firebird 4 migration guide
|
|
537
|
+
<https://ib-aid.com/download/docs/fb4migrationguide.html#_authorization_with_firebird_2_5_client_library_fbclient_dll>
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
|
|
504
541
|
## Contributors
|
|
505
542
|
|
|
506
543
|
- Henri Gourvest, <https://github.com/hgourvest>
|