1// each row : fctname : [params], typeofreturnvar fbsvc = { "backup" : { [ "options"], "stream" }, "nbackup" : { [ "options"], "stream" }, "restore" : { [ "options"], "stream" }, "nrestore" : { [ "options"], "stream" }, "setDialect": { [ "database","dialect"], "stream" }, "setSweepinterval": { [ "database","sweepinterval"], "stream" }, "setCachebuffer" : { [ "database","nbpagebuffers"], "stream" }, "BringOnline" : { [ "database"], "stream" }, "Shutdown" : { [ "database","shutdown","shutdowndelay","shutdownmode"], "stream" }, "setShadow" : { [ "database","activateshadow"], "stream" }, "setForcewrite" : { [ "database","forcewrite"], "stream" }, "setReservespace" : { [ "database","reservespace"], "stream" }, "setReadonlyMode" : { [ "database"], "stream" }, "setReadwriteMode" : { [ "database"], "stream" }, "validate" : { [ "options"], "stream" }, "commit" : { [ "database", "transactid"], "stream" }, "rollback" : { [ "database", "transactid"], "stream" }, "recover" : { [ "database", "transactid"], "stream" }, "getStats" : { [ "options"], "stream" }, "getLog" : { [ "options"], "stream" }, "getUsers" : { [ "username"], "object" }, "addUser" : { [ "username", "password", "options"], "stream" }, "editUser" : { [ "username", "options"], "stream" }, "removeUser" : { [ "username","rolename"], "stream" }, "getFbserverInfos" : { [ "options", "options"], "object" }, "startTrace" : { [ "options"], "stream" }, "suspendTrace" : { [ "options"], "stream" }, "resumeTrace" : { [ "options"], "stream" }, "stopTrace" : { [ "options"], "stream" }, "getTraceList" : { [ "options"], "stream" }, "hasActionRunning" : { [ "options"], "object"}}
1// 5 = the number is count of opened socketsvar pool = Firebird.pool(5, options); // Get a free poolpool.get(function(err, db) { if (err) throw err; // db = DATABASE db.query('SELECT * FROM TABLE', function(err, result) { // IMPORTANT: release the pool connection db.detach(); });}); // Destroy poolpool.destroy();
1AuthServer = Srp, Legacy_AuthWireCrypt = DisabledUserManager = Legacy_UserManager
1Firebird.attach(options, function(err, db) { if (err) throw err; // db = DATABASE db.sequentially('SELECT * FROM BIGTABLE', function(row, index) { // EXAMPLE stream.write(JSON.stringify(row)); }, function(err) { // END // IMPORTANT: close the connection db.detach(); });});
1Firebird.attach(options, function(err, db) { if (err) throw err; // db = DATABASE // INSERT BUFFER as BLOB db.query('INSERT INTO USERS (ID, ALIAS, FILE) VALUES(?, ?, ?)', [1, 'Peter', fs.readFileSync('/users/image.jpg')], function(err, result) { // IMPORTANT: close the connection db.detach(); });});
1var sql1 = 'SELECT * FROM TBL_USER WHERE ID>' + Firebird.escape(1);var sql2 = 'SELECT * FROM TBL_USER WHERE NAME=' + Firebird.escape('Pe\'er');var sql3 = 'SELECT * FROM TBL_USER WHERE CREATED<=' + Firebird.escape(new Date());var sql4 = 'SELECT * FROM TBL_USER WHERE NEWSLETTER=' + Firebird.escape(true); // or db.escape() console.log(sql1);console.log(sql2);console.log(sql3);console.log(sql4);
1var options = {}; options.host = '127.0.0.1';options.port = 3050;options.database = 'database.fdb';options.user = 'SYSDBA';options.password = 'masterkey';options.lowercase_keys = false; // set to true to lowercase keysoptions.role = null; // defaultoptions.pageSize = 4096; // default when creating database
1const options = {...}; // Classic configuration with manager = trueFirebird.attach(options, function(err, svc) { if (err) return; svc.backup( { database:'/DB/MYDB.FDB', files: [ { filename:'/DB/MYDB.FBK', sizefile:'0' } ] }, function(err, data) { data.on('data', line => console.log(line)); data.on('end', () => svc.detach()); } );});
1const config = {...}; // Classic configuration with manager = trueconst RESTORE_OPTS = { database: 'database.fdb', files: ['backup.fbk']}; Firebird.attach(config, (err, srv) => { srv.restore(RESTORE_OPTS, (err, data) => { data.on('data', () => {}); data.on('end', () => srv.detach(); }); });});
1Firebird.attach(options, function(err, db) { if (err) throw err; // db = DATABASE db.query('INSERT INTO USERS (ID, ALIAS, CREATED) VALUES(?, ?, ?) RETURNING ID', [1, 'Pe\'ter', new Date()], function(err, result) { console.log(result[0].id); db.query('SELECT * FROM USERS WHERE Alias=?', ['Peter'], function(err, result) { console.log(result); db.detach(); }); });});