mysql-activerecord
Advanced tools
Comparing version 0.8.2 to 0.8.3
38
index.js
@@ -34,4 +34,11 @@ /** | ||
var mysql = require('mysql'); | ||
if (!settings.server) { | ||
if(settings.server) { | ||
settings.host = settings.server; | ||
} | ||
if(settings.username) { | ||
settings.user = settings.username; | ||
} | ||
if (!settings.host) { | ||
throw new Error('Unable to start ActiveRecord - no server given.'); | ||
@@ -42,4 +49,4 @@ } | ||
} | ||
if (!settings.username) { | ||
settings.username = ''; | ||
if (!settings.user) { | ||
settings.user = ''; | ||
} | ||
@@ -53,9 +60,3 @@ if (!settings.password) { | ||
var connection = new mysql.createConnection({ | ||
host: settings.server, | ||
port: settings.port, | ||
user: settings.username, | ||
password: settings.password, | ||
database: settings.database | ||
}); | ||
var connection = new mysql.createConnection(settings); | ||
@@ -212,3 +213,8 @@ if (settings.charset) { | ||
connection.query(combinedQueryString, function(err, res) { responseCallback(null, res[0]['count'])}); | ||
connection.query(combinedQueryString, function(err, res) { | ||
if (err) | ||
responseCallback(err, null); | ||
else | ||
responseCallback(null, res[0]['count']); | ||
}); | ||
resetQuery(combinedQueryString); | ||
@@ -263,3 +269,3 @@ } | ||
this.having = function(set) { | ||
havingClause = this.comma_seperated_arguments(set); | ||
havingClause = this.comma_separated_arguments(set); | ||
return that; | ||
@@ -289,6 +295,6 @@ }; | ||
this.insert = function(tableName, dataSet, responseCallback, verb, querySuffix) { | ||
if (typeof verb === 'undefined') { | ||
var verb = 'INSERT'; | ||
} | ||
if (Object.prototype.toString.call(dataSet) !== '[object Array]') { | ||
if (typeof verb === 'undefined') { | ||
var verb = 'INSERT'; | ||
} | ||
if (typeof querySuffix === 'undefined') { | ||
@@ -295,0 +301,0 @@ var querySuffix = ''; |
{ | ||
"name" : "mysql-activerecord", | ||
"version": "0.8.2", | ||
"version": "0.8.3", | ||
"author": "Martin Tajur <martin@tajur.ee>", | ||
@@ -5,0 +5,0 @@ "description": "MySQL ActiveRecord pattern implementation on top of the mysql module.", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24289
387