persistence.js is an asynchronous Javascript database mapper library. You can use it in the browser, as well on the server (and you can share data models between them).
I'm trying to get persistence-js working with the lastet version of node-mysql using this code:
var persistence = require('persistencejs/lib/persistence').persistence;
var persistenceStore = require('persistencejs/lib/persistence.store.mysql');
persistenceStore.config(persistence, 'localhost', 3306, 'test2', 'root', 'xxxxxx');
var session = persistenceStore.getSession();
and I'm running into the following error:
node_modules/persistencejs/lib/persistence.store.mysql.js:21
var client = mysql.createClient({
^
TypeError: Object #
Based on the node-mysql readme file, it looks like the createClient method is no longer supported:
v2.0.0-alpha (2012-05-15)
This release is a rewrite. You should carefully test your application after
upgrading to avoid problems.
...
The first thing you will run into is that the old Client class is gone and
has been replaced with a less ambitious Connection class. So instead of
mysql.createClient(), you now have to:
var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'localhost',
user : 'me',
password : 'secret',
});
So are we limited to using earlier versions of node-mysql or am I doing something wrong?
I'm trying to get persistence-js working with the lastet version of node-mysql using this code:
var persistence = require('persistencejs/lib/persistence').persistence; var persistenceStore = require('persistencejs/lib/persistence.store.mysql');
persistenceStore.config(persistence, 'localhost', 3306, 'test2', 'root', 'xxxxxx'); var session = persistenceStore.getSession();
and I'm running into the following error:
node_modules/persistencejs/lib/persistence.store.mysql.js:21 var client = mysql.createClient({ ^ TypeError: Object #
Based on the node-mysql readme file, it looks like the createClient method is no longer supported:
v2.0.0-alpha (2012-05-15)
This release is a rewrite. You should carefully test your application after upgrading to avoid problems. ... The first thing you will run into is that the old Client class is gone and has been replaced with a less ambitious Connection class. So instead of mysql.createClient(), you now have to:
var mysql = require('mysql'); var connection = mysql.createConnection({ host : 'localhost', user : 'me', password : 'secret', });
So are we limited to using earlier versions of node-mysql or am I doing something wrong?