Comparing version 0.8.6 to 0.8.7
var mysql = require('../test/common').createConnection(); | ||
mysql.execute("select ?+1 as qqq, ? as rrr, ? as yyy", [1, null, 3], function(err, rows, fields) { | ||
mysql.execute("select ?+1 as qqq, ? as rrr, ? as yyy", [-4, null, 3], function(err, rows, fields) { | ||
//mysql.execute("select ?+?+? as qqq, ? as rrr", [1, 2, 5, "test"], function(err, rows, fields) { | ||
console.log(err, rows, fields); | ||
}); |
@@ -38,3 +38,3 @@ var FieldFlags = require('./constants/field_flags'); | ||
var src = result.join('\n'); | ||
return vm.runInNewContext(src); | ||
return vm.runInThisContext(src); | ||
} | ||
@@ -44,10 +44,11 @@ | ||
function readCodeFor(type, flags) { | ||
var unsigned = flags & FieldFlags.UNSIGNED; | ||
switch(type) { | ||
case Types.MYSQL_TYPE_TINY: | ||
return "packet.readInt8();"; | ||
return unsigned ? "packet.readInt8();" : "packet.readSInt8();"; | ||
case Types.SHORT: | ||
return "packet.readInt16();"; | ||
return unsigned ? "packet.readInt16();" : "packet.readSInt16();"; | ||
case Types.LONG: | ||
case Types.INT24: // in binary protocol int24 is encoded in 4 bytes int32 | ||
return "packet.readInt32();"; | ||
return unsigned ? "packet.readInt32();" : "packet.readSInt32();"; | ||
case Types.YEAR: | ||
@@ -54,0 +55,0 @@ return "\'not implemented\';"; |
@@ -13,3 +13,3 @@ var Types = require('./constants/types'); | ||
var src = result.join('\n'); | ||
return vm.runInNewContext(src); | ||
return vm.runInThisContext(src); | ||
} | ||
@@ -16,0 +16,0 @@ |
@@ -51,3 +51,3 @@ //var BigNumber = require("bignumber.js"); | ||
this.offset += 2; | ||
return this.buffer.readUInt16LE(this.offset - 2); | ||
return this.buffer.readUInt16LE(this.offset - 2, true); | ||
}; | ||
@@ -62,5 +62,24 @@ | ||
this.offset += 4; | ||
return this.buffer.readUInt32LE(this.offset - 4); | ||
return this.buffer.readUInt32LE(this.offset - 4, true); | ||
}; | ||
Packet.prototype.readSInt8 = function() | ||
{ | ||
return this.buffer.readInt8(this.offset, true); | ||
}; | ||
Packet.prototype.readSInt16 = function() | ||
{ | ||
this.offset += 2; | ||
return this.buffer.readInt16LE(this.offset - 2, true); | ||
}; | ||
Packet.prototype.readSInt32 = function() | ||
{ | ||
this.offset += 4; | ||
return this.buffer.readInt32LE(this.offset - 4, true); | ||
}; | ||
Packet.prototype.isEOF = function() { | ||
@@ -67,0 +86,0 @@ return this.buffer[this.offset] == 0xfe && this.length() < 9; |
{ | ||
"name": "mysql2", | ||
"version": "0.8.6", | ||
"version": "0.8.7", | ||
"description": "fast mysql driver. Implements core protocol, prepared statements, ssl and compression in native JS", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -70,3 +70,2 @@ #node-mysql2 | ||
var shape = require('shaper'); | ||
var slowConnection = shape(10); // 10 bytes/sec | ||
var connection = mysql.createConnection({ | ||
@@ -96,10 +95,11 @@ user: 'test', | ||
}); | ||
var remote = mysql.createConnection({user: 'root', database: 'test'}); | ||
conn.on('query', function(sql) { | ||
console.log('proxying query:' + sql); | ||
var cli = mysql.createConnection({user: 'root', database: 'test'}); | ||
cli.query(sql, function(err, rows, columns) { | ||
remote.query(sql, function(err, rows, columns) { | ||
conn.writeTextResult(rows, columns); | ||
}); | ||
}); | ||
conn.on('end', remote.end.bind(remote)); | ||
}); | ||
@@ -106,0 +106,0 @@ ``` |
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
187144
88
4291