npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@el3um4s/node-adodb

v5.0.17

Published

A Node.js JavaScript Client implementing the ADODB protocol.

Downloads

37

Readme

node-adodb

This package is an updated version of Nuintun's node-adodb. All credit goes to Nuintun. And all the code is his. I created this fork to try some experiments. I recommend using the original version.

link: https://github.com/nuintun/node-adodb

A node.js javascript client implementing the ADODB protocol on windows.

Install

npm install @el3um4s/node-adodb

Introduction:

ES6
'use strict';

const ADODB = require('node-adodb');
const connection = ADODB.open('Provider=Microsoft.Jet.OLEDB.4.0;Data Source=node-adodb.mdb;');

// Transaction
connection
  .transaction([
    `INSERT INTO Users(UserId, UserName, UserSex, UserBirthday, UserMarried) VALUES (10, "Tom", "Male", "1981/5/10", 0);`,
    `INSERT INTO Users(UserId, UserName, UserSex, UserBirthday, UserMarried) VALUES (11, "Brenda", "Female", "2001/1/11", 0);`,
    `INSERT INTO Users(UserId, UserName, UserSex, UserBirthday, UserMarried) VALUES (10, "Bill", "Male", "1991/3/9", 0);`,
  ])
  .then((data) => {
    console.log('We will not arrive because a duplicate id is generated. When encountering an error do not insert any record.');
  })
  .catch((error) => {
    console.error(error);
  });

// Execute
connection
  .execute('INSERT INTO Users(UserName, UserSex, UserAge) VALUES ("Newton", "Male", 25)')
  .then((data) => {
    console.log(JSON.stringify(data, null, 2));
  })
  .catch((error) => {
    console.error(error);
  });

// Execute with scalar
connection
  .execute('INSERT INTO Users(UserName, UserSex, UserAge) VALUES ("Newton", "Male", 25)', 'SELECT @@Identity AS id')
  .then((data) => {
    console.log(JSON.stringify(data, null, 2));
  })
  .catch((error) => {
    console.error(error);
  });

// Query
connection
  .query('SELECT * FROM Users')
  .then((data) => {
    console.log(JSON.stringify(data, null, 2));
  })
  .catch((error) => {
    console.error(error);
  });

// Schema
connection
  .schema(20)
  .then((schema) => {
    console.log(JSON.stringify(schema, null, 2));
  })
  .catch((error) => {
    console.error(error);
  });
ES7 async/await
'use strict';

const ADODB = require('node-adodb');
const connection = ADODB.open('Provider=Microsoft.Jet.OLEDB.4.0;Data Source=node-adodb.mdb;');

async function query() {
  try {
    const users = await connection.query('SELECT * FROM Users');

    console.log(JSON.stringify(users, null, 2));
  } catch (error) {
    console.error(error);
  }
}

query();

API:

ADODB.open(connection[, x64]): ADODB

Initialization database link parameters.

ADODB.query(sql): Promise

Execute a SQL statement that returns a value.

ADODB.execute(sql[, scalar]): Promise

Execute a SQL statement with no return value or with updated statistics.

ADODB.transaction(sql[]): Promise

Execute multiple SQL statement as a transaction.

ADODB.schema(type[, criteria][, id]): Promise

Query database schema information. see: OpenSchema

Debug:

Set env DEBUG=ADODB, see: debug

Extension:

This library theory supports all databases on the Windows platform that support ADODB connections, and only need to change the database connection string to achieve the operation!

Common access connection strings:

  • Access 2000-2003 (*.mdb): Provider=Microsoft.Jet.OLEDB.4.0;Data Source=node-adodb.mdb;
  • Access > 2007 (*.accdb): Provider=Microsoft.ACE.OLEDB.12.0;Data Source=adodb.accdb;Persist Security Info=False; or Provider=Microsoft.ACE.OLEDB.15.0;Data Source=adodb.accdb;Persist Security Info=False;

Notes:

The library need system support Microsoft.Jet.OLEDB.4.0 or Microsoft.ACE.OLEDB.12.0, Windows XP SP2 above support Microsoft.Jet.OLEDB.4.0 by default, Others need to install support!

Recommended use Microsoft.ACE.OLEDB.12.0, download: Microsoft.ACE.OLEDB.12.0

Electron

If you want to use this module in an electron app running from an asar package you'll need to make some changes.

  1. Move adodb.js outside the asar package (in this example I use electron-builder, the extraResources option can move the file outside the asar package)
"extraResources": [
  {
    "from": "./node_modules/node-adodb/lib/adodb.js",
    "to": "adodb.js"
  }
]
  1. Tell the module where to find adodb.js while running from an asar package (I added this in electron's main.js file)
// Are we running from inside an asar package ?
if (process.mainModule.filename.indexOf('app.asar') !== -1) {
  // In that case we need to set the correct path to adodb.js
  ADODB.PATH = './resources/adodb.js';
}