Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mysql2

Package Overview
Dependencies
Maintainers
1
Versions
186
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mysql2 - npm Package Compare versions

Comparing version 0.8.6 to 0.8.7

examples/signed.js

2

examples/execute.js
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 @@ ```

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc