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 🙏

© 2025 – Pkg Stats / Ryan Hefner

nedgedb

v1.0.61

Published

node module for openedge database with nosql interface

Readme

nedgedb

Node module for Progress OpenEdge database with nosql front end interface.

Description

This library helps you perform CRUD operations on OpenEdge Database both synchronuosly or asynchronously from a node.js application. The node module communicates with the ODBC drivers installed which in turn fetches records from the database as JSON objects.

Installation

npm install nedgedb

For linux

Requires installed unixODBC

  • Ubuntu/Debian $ sudo apt-get unixodbc unixodbc-dev
  • Fedora/Red Hat/CentOS $ sudo yum install unixODBC unixODBC-devel libtool-ltdl libtool-ltdl-devel
  • Proper odbc configuration, follow the steps here to correctly configure your odbc installation
    • http://knowledgebase.progress.com/articles/Article/P21252

Configuring OpenEdge

Set progress environment by the command proenv. Prodb creates a database. Proserve starts the OpenEdge database on a specific port number

proenv
prodb "databasename_to_be_copied" "databasename_to_be_copied_to"
proserve "databasename" -S "portnumber"

We would be required to use prodb only for the first time.

Sample Programs

Note : Replace the dsn_name, user_name, password and table_name in the following sample programs with the actual credentials of your openedge database

Sync Implementation

var nedgedb = require('nedgedb');

var db = new nedgedb.database("dsn_name","user_name","password");

var records=[];
var collection;

var err = db.connectSync();
if(err){
	throw err;
}
else{
	console.log("\nConnected Successfully");
	collection = db.collection("table_name");
}

var query = { "column1" : { "$eq" : 22222} };
var list = [column1,column2...];
var order = {CustNum : 1};
var limit = 30;
/*
	collection.find()  attributes:
	1.query		(Where clause of SQL given in json similar to mongodb)
	2.list		(All the columns that are to be fetched to be given in an array)
	3.order		(Sorted order of the given records to be given in json similat to mongodb)
	4.limit		(SQL_limit)
	5.callback  (A cursor to records is returned if the callback is not used)
	If the callback is not given it everything in find happens in Sync(similar to findSync)
*/
collection.findSync(query,list,order,limit,function(err,res){			
	records.push.apply(records,res);
});
console.log("Total number of records Received = ",records.length);

err = db.disconnectSync();
if(err){
	throw err;
}
else{
	console.log("Disconnected Successfully\n");
}

Async Implementation

var nedgedb = require('nedgedb');
var db =new nedgedb.database("dsn_name","user_name","password");

var collection = db.collection("table_name");

db.connect(function(err){
	if(err){
		throw err;
	}
	else{
		console.log("connected Successfully\n");
		/*
			collection.find()  attributes:
				1.query		(Where clause of SQL given in json similar to mongodb)
				2.list		(All the columns that are to be fetched to be given in an array)
				3.order		(Sorted order of the given records to be given in json similat to mongodb)
				4.limit		(SQL_limit)
				5.callback  (A cursor to records is returned if the callback is not used)
				If the callback is not given it everything in find happens in Sync(similar to findSync)
				
			If query is an empty json, all records are selected ans similarly for list
			If order is an empty json, the sotring will be based on primary key
			If the limit is negative then all the records are fetched
		*/
		collection.find({},[],{},-1,function(err,res){
			if(err){
				throw err;
			}
			else{
				console.log("Length of received Result = ",res.length,"\n");
			}
			db.disconnect(function(err,res){
				if(err){
					throw err;
				}
				else{
					console.log("Disconnected Successfully\n");
				}
			})
			console.log("Disconnect is Async\n");
		});
		
		console.log("Find is Async\n");
	}
});

console.log("\nConnect is Async\n");

Async CRUD Operations

//Async Crud Implementation
var nedgedb = require('nedgedb');

var db =new nedgedb.database("mydsn","pmanyam","");

var collection = db.collection("customer");


query = { "CustNum" : { "$eq" : 22222}  };

var record = {
	CustNum : '22222',
	Name : 'puneeth'
}

var record2 = {
	CustNum : 22222,
	Name : "Raju"
}

var list = [ "CustNum","Name"];
var order = {CustNum : 1};

db.connect(function(err){
	if(err){
		throw err;
	}
	else{
		console.log("Connected Successfully\n");
	}
	var res = collection.find(query,list,order);
	if(res.err){
		throw res.err;
	}
	else{
		console.log("Records with custnum 22222 => ",res.records,"\n\n");
	}
	/*
		collection.insert("record to be inserted",callback(err))
	*/
	collection.insert(record,function(err){   
		if(err){
			throw err;
		}
		else{
			console.log("New Record Inserted\n");
		}
		
		res = collection.find(query,list,order);
		if(res.err){
			throw res.err;
		}
		else{
			console.log("Records with custnum 22222 => ",res.records,"\n\n");
		}
	
		/*
			collection.update((record to be inserted),(condition for selecting which records are to be updated),callback(err))
		*/
		collection.update(record2,query,function(err){
			if(err){
				throw err;
			}
			else{
				console.log("Record Updated\n");
			}
			res = collection.find(query,list,order);
			if(res.err){
				throw res.err;
			}
			else{
				console.log("Records with custnum 22222 => ",res.records,"\n\n");
			}
			
			/*
				collection.remove((condition for selecting which records are to be deleted),callback(err))
			*/
			collection.remove(query,function(err){
				if(err){
					throw err;
				}
				else{
					console.log("Record Deleted\n");
				}
				res = collection.find(query,list,order);
				if(res.err){
					throw res.err;
				}
				else{
					console.log("Records with custnum 22222 => ",res.records,"\n\n");
				}
				db.disconnect(function(err){
					if(err){
						throw err;
					}
					else{
						console.log("Disconnected Successfully\n");
					}
				});
				
				console.log("\n\nDisconnecting Asynchronously\n");
			});
			console.log("\n\nDeleting Asynchronously\n");
		});
		console.log("\n\nUpdating Asynchronously\n");
	});
	console.log("\n\nInserting Asynchronously\n");
});
console.log("\nConnecting Asynchronously\n");

###Cursor Usage

//Cursor Implementation
var nedgedb = require('nedgedb');

var db = new nedgedb.database("dsn_name","user_name","password");

var collection = db.collection("table_name");

var print_res = function(err,res){
	if(err){
		throw err;
	}
	else{
		console.log(res.CustNum);
		console.log();
	}
}

var err = db.connectSync();
if(err){
	throw err;
}
else{
	console.log("\nConnected Successfully\n");
}

/*
	If the callback was not provided for the collection.find or collection.findSync a cursor to the records is returned
	Cursor functionalities:
	--> cursor.err => Error in fetching records
	--> cursor.cur_record => Current record number(-1  if no records are fetched)
	--> cursor.records => Fetched Records in an array
	--> cursor.len => No.of records fetched
	--> cursor.record(callback(err,res)) gives the present record in res and err in accessing the record in err.
			err = "No_Records" if no records are fetched.
				= "End_Of_Records" if present record number was more than the number of fetched records
				= "Negative" if a negative record number was attempted to access
				= error in fetching otherwise
				= 0 if everything was fine
	--> cursor.next(offset) skips offset number of records. offset can be +ve or -ve. If no offset is given a default of 1 is taken
	--> cursor.rewind() rewinds the cursor
	--> cursor.end() takes the cursor to end
*/
var cursor = collection.findSync({},[],{});

cursor.record(print_res);

cursor.next();
cursor.record(print_res);

cursor.rewind();
cursor.record(print_res);

cursor.end();
cursor.record(print_res);

cursor.rewind();
cursor.next(4);
cursor.record(print_res);


err = db.disconnectSync();
if(err){
	throw err;
}
else{
	console.log("\nDisconnectred Successfully\n");
}