0.0.3 • Published 10 years ago
seneca-msaccess-store v0.0.3
seneca-msaccess-store
Based on seneca-mysql-store, seneca-oracle-store and seneca-sybase-store.
This project uses odbc to connect to Microsoft Access. Currently the odbc driver options for OSX/Linux to communicate to Microsoft Access are grim, therefore this module will only work in a Windows enviroment.
Tested on:
- node@0.10.26
- seneca@0.6.1
Prerequisites
- node v0.10.x - breaking changes in v0.11 and up with the odbc module; issue
- nvm for windows is convenient
- git for windows
- use git bash for windows!
- Microsoft Access drivers
- Specfic libraries requried for node-gyp
- Python 2.7.3
- Microsoft Visual Studio C++ 2012 for Windows Desktop Express version works well
- 64-bit build's of node require .net 64 bit SDK
Install
With npm:
npm install seneca-msaccess-store
Usage
var seneca = require('seneca')();
/*
* Connection options
* For information on access odbc connection strings:
* https://www.connectionstrings.com/access/
*/
//using a connection string
seneca.use('msaccess-store', {
connection: 'Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=w:\\seneca-msaccess-store\\test\\TestDB.accdb;'
});
//or pass the connection details as an object
seneca.use('msaccess-store', {
connection: {
driver: '{Microsoft Access Driver (*.mdb, *.accdb)}',
dbPath: 'w:\\seneca-msaccess-store\\test\\TestDB.accdb',
user: '',
password: ''
}
});
/**
* Pool options
* For more information on its options see https://github.com/coopernurse/node-pool
*/
seneca.use('msaccess-store', {
connection: {
driver: '{Microsoft Access Driver (*.mdb, *.accdb)}',
dbPath: 'w:\\seneca-msaccess-store\\test\\TestDB.accdb',
user: '',
password: ''
},
pool: {
min: 1,
max: 10,
log: true,
idleTimeoutMillis: 10000 // specifies how long a resource can stay idle in pool before being removed
}
});
/**
* Creating and saving an 'apple' entity
*/
seneca.ready(function(){
var apple = seneca.make$('fruit')
apple.name = 'Pink Lady'
apple.price = 0.99
apple.save$(function(err,apple){
console.log( "apple.id = "+apple.id )
})
})
TODO
- Tidy up entityFactory
- Sql, sort and limit tests from seneca store tests
- Native tests, specific to ms access