Socket
Socket
Sign inDemoInstall

mysql2

Package Overview
Dependencies
Maintainers
1
Versions
184
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.0.1 to 0.0.2

.travis.yml

35

lib/commands/query.js

@@ -11,4 +11,5 @@ var Command = require('./command');

this.fieldCount = 0;
this.fields = [];
this.rows = [];
this.insertId = 0;
this.fields = [];
this.rows = [];
}

@@ -26,2 +27,8 @@ util.inherits(Query, Command);

this.fieldCount = rs.fieldCount;
this.insertId = rs.insertId;
if (this.fieldCount === 0) {
if (this.onResult)
this.onResult(null, [], []);
return null;
}
return Query.prototype.readField;

@@ -55,11 +62,9 @@ };

if (packet.isEOF()) {
this.onResult(null, this.rows, this.fields);
if (this.onResult)
this.onResult(null, this.rows, this.fields);
return null;
}
//console.log(this.rows.length);
//console.log(this.rows);
var row = Packets.TextRow.fromPacket(packet);
if (process.env.QQQ)
this.rows.push(['aaa', 'bbb']); //this.rows.push(new Row(row.columns));
else //if (process.env.HASH) {
// TODO: here we'll have dynamically pre-compiled and cached row parser
if (true) // TODO: think of API to store raw copulns array (most probably connection options flags)
{

@@ -72,6 +77,12 @@ var r = {};

}
this.rows.push(r);
} //else
//this.rows.push(row.columns);
if (this.onResult)
this.rows.push(r);
else
this.emit('result', r);
} else {
if (this.onResult)
this.rows.push(row.columns);
else
this.emit('result', row.columns);
}
return Query.prototype.row;

@@ -78,0 +89,0 @@ };

@@ -48,13 +48,2 @@ var _ = require('underscore');

}
//console.log('packet num: ', cnt);
//cnt++;
//if (cnt == 500007) {
// var end = process.hrtime(startTime);
// var ns = end[1] + end[0]*10e9;
// console.log('Done!', 500000*10e9/ns);
//}
//if (cnt > 5)
// return;
//
//if (packet)

@@ -73,7 +62,4 @@ // console.log('PACKET:', packet.payload, packet.payload.length);

var cnt1 = 0;
// TODO: check stream instanceof net.Stream, fallback if not
this.stream.ondata = function(data, start, end) {
//console.log(data, start, end);
//cnt1++;
//console.log('cnt1: ', cnt1);
// 183
connection.packetParser._write(data.slice(start, end));

@@ -80,0 +66,0 @@ };

@@ -13,12 +13,10 @@ var _ = require('underscore');

hash.update(msg2);
var digest = hash.digest();
// pre node 0.10 hash.digest() returns string
if (Buffer.isBuffer(digest))
return digest;
else {
return Buffer(digest);
}
return hash.digest('binary');
}
function xor(a, b) {
if (!Buffer.isBuffer(a))
a = new Buffer(a, 'binary');
if (!Buffer.isBuffer(b))
b = new Buffer(b, 'binary');
var result = new Buffer(a.length);

@@ -36,3 +34,3 @@ for (var i = 0; i < a.length; i++) {

}
var stage1 = sha1(Buffer(password, "utf8"));
var stage1 = sha1(Buffer(password, "utf8").toString('binary'));
var stage2 = sha1(stage1);

@@ -39,0 +37,0 @@ var stage3 = sha1(scramble1, scramble2, stage2);

@@ -16,3 +16,3 @@ //var BigNumber = require("bignumber.js");

return this.payload.length > this.offset;
}
};

@@ -63,2 +63,3 @@ Packet.prototype.skip = function(num) {

return null;
debugger;
throw "Should not reach here: " + byte1;

@@ -172,5 +173,2 @@ };

return this.writeInt16(n);
console.log(n);
console.log(this.payload);
process.exit(0);
}

@@ -177,0 +175,0 @@ if (this < 0xffffff) {

@@ -7,2 +7,4 @@ //var constants = require('../constants');

this.fieldCount = packet.readLengthCodedNumber();
if (packet.haveMoreData())
this.insertId = packet.readLengthCodedNumber();
// TODO: extra

@@ -9,0 +11,0 @@ }

@@ -12,3 +12,2 @@ //var constants = require('../constants');

var columns = [];
console.log(packet, packet.payload.length);
while(packet.haveMoreData()) {

@@ -25,7 +24,5 @@ columns.push(packet.readLengthCodedString());

column = this.columns[i];
console.log('qqqqqq', Packet.lengthCodedNumberLength(column));
length += Packet.lengthCodedNumberLength(column);
length += column.length;
}
console.log('length:', length);
buffer = new Buffer(length+4);

@@ -32,0 +29,0 @@ packet = new Packet(sequenceId, buffer);

{
"name": "mysql2",
"version": "0.0.1",
"version": "0.0.2",
"description": "fast mysql driver",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -0,4 +1,4 @@

[![Build Status](https://secure.travis-ci.org/sidorares/node-mysql2.png)](http://travis-ci.org/sidorares/node-mysql2)
Work in progress.
Aims to be faster drop-in replacement driver for https://github.com/felixge/node-mysql
At the moment node 0.10+ only!
module.exports.createConnection = function() {
// hrtime polyfill for old node versions:
if (!process.hrtime)
process.hrtime = function(start) {
start = [0, 0] || start;
var timestamp = Date.now();
var seconds = Math.ceil(timestamp/1000);
return [seconds - start[0], (timestamp-seconds*1000)*1000 - start[1]];
};
return require('../index.js').createConnection({
user: 'root',
password: 'test',
host: process.env.MYSQL_HOST || '127.0.0.1',
user: process.env.MYSQL_USER || 'root',
password: process.env.CI ? null : 'test',
database: 'test',
socketPath: '/tmp/mysql.sock'
port: process.env.MYSQL_PORT || 3306
});
};
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