Socket
Book a DemoInstallSign in
Socket

limber-firebird-knex

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

limber-firebird-knex

Knex dialect for FirebirdSQL RDBMS

latest
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source
var knex = require('knex')({
  client: require('limber-firebird-knex'),
  connection: {
    host: "127.0.0.1",
    port: 3050,
    user: "SYSDBA",
    password: "masterkey",
    database: __dirname + '/data.fdb'
  }
});

// Create a table
knex.schema.createTable('users', function(table) {
  table.increments('id');
  table.string('user_name');
})

// ...and another
.createTable('accounts', function(table) {
  table.increments('id');
  table.string('account_name');
  table.integer('user_id').unsigned().references('users.id');
})

// Then query the table...
.then(function() {
  return knex.insert({id: 1, user_name: 'Tim'}).into('users');
})

// ...and using the insert id, insert into the other table.
.then(function() {
  return knex.table('accounts').insert({id: 101, account_name: 'knex', user_id: 1});
})

// Query both of the rows.
.then(function() {
  return knex('users')
    .join('accounts', 'users.id', 'accounts.user_id')
    .select('users.user_name as user_name', 'accounts.account_name as account');
})

// .map over the results
.map(function(row) {
  console.log(row);
})

.then(function() {
  knex.destroy();
})

// Finally, add a .catch handler for the promise chain
.catch(function(e) {
  console.error(e);
});

Keywords

node

FAQs

Package last updated on 24 Aug 2020

Did you know?

Socket

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.

Install

Related posts