Skip to content

Commit

Permalink
Added flag to allow unicode strings
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasHambach committed Jan 8, 2016
1 parent 8427412 commit 3905973
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion lib/dialects/mssql/query-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
var Utils = require('../../utils')
, DataTypes = require('../../data-types')
, Model = require('../../model')
, AbstractQueryGenerator = require('../abstract/query-generator');
, AbstractQueryGenerator = require('../abstract/query-generator')
, SqlString = require('../../sql-string');

/* istanbul ignore next */
var throwMethodUndefined = function(methodName) {
Expand Down Expand Up @@ -603,7 +604,27 @@ var QueryGenerator = {

booleanValue: function(value) {
return !!value ? 1 : 0;
},

escape: function(value, field) {
if (value && value._isSequelizeMethod) {
return this.handleSequelizeMethod(value);
} else {
if (field && field.type && value) {
if (field.type.validate) {
field.type.validate(value);
}
}

var escaped = SqlString.escape(value, false, this.options.timezone, this.dialect, field);
if (typeof value === "string" && (!field || field.type instanceof DataTypes.STRING)) {
return 'N' + escaped;
}
return escaped;

}
}

};

// private methods
Expand Down

0 comments on commit 3905973

Please sign in to comment.