Merge branch 'release/1.3.0' into production

This commit is contained in:
Miroslav Bajtoš 2014-06-04 09:58:38 +02:00
commit 879b31b915
2 changed files with 20 additions and 6 deletions

View File

@ -3,7 +3,7 @@
*/
var mysql = require('mysql');
var juggler = require('loopback-datasource-juggler');
var SqlConnector = require('loopback-connector').SqlConnector;
var EnumFactory = require('./enumFactory').EnumFactory;
var debug = require('debug')('loopback:connector:mysql');
@ -69,9 +69,7 @@ exports.initialize = function initializeDataSource(dataSource, callback) {
dataSource.connector = new MySQL(dataSource.client, s);
dataSource.connector.dataSource = dataSource;
// MySQL specific column types
juggler.ModelBuilder.registerType(function Point() {
});
defineMySQLTypes(dataSource);
dataSource.EnumFactory = EnumFactory; // factory for Enums. Note that currently Enums can not be registered.
@ -82,6 +80,21 @@ exports.initialize = function initializeDataSource(dataSource, callback) {
exports.MySQL = MySQL;
function defineMySQLTypes(dataSource) {
var modelBuilder = dataSource.modelBuilder;
var defineType = modelBuilder.defineValueType ?
// loopback-datasource-juggler 2.x
modelBuilder.defineValueType.bind(modelBuilder) :
// loopback-datasource-juggler 1.x
modelBuilder.constructor.registerType.bind(modelBuilder.constructor);
// The Point type is inherited from jugglingdb mysql adapter.
// LoopBack uses GeoPoint instead.
// The Point type can be removed at some point in the future.
defineType(function Point() {
});
}
/**
* @constructor
* Constructor for MySQL connector
@ -94,7 +107,7 @@ function MySQL(client, settings) {
this.settings = settings;
}
require('util').inherits(MySQL, juggler.BaseSQL);
require('util').inherits(MySQL, SqlConnector);
/**
* Execute the sql statement

View File

@ -1,12 +1,13 @@
{
"name": "loopback-connector-mysql",
"version": "1.2.3",
"version": "1.3.0",
"description": "MySQL connector for loopback-datasource-juggler",
"main": "index.js",
"scripts": {
"test": "mocha"
},
"dependencies": {
"loopback-connector": "1.x",
"mysql": "~2.3.0",
"async": "~0.9.0",
"debug": "~0.8.0"