Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: felixge/node-mysql
...
head fork: felixge/node-mysql
  • 5 commits
  • 7 files changed
  • 0 commit comments
  • 1 contributor
Commits on Sep 02, 2010
Felix Geisendörfer Add contributors to readme 5e1183f
Felix Geisendörfer Update todos ee63231
Commits on Sep 17, 2010
Felix Geisendörfer Test case showing column ordering bug
Original test case by Bert Belder:
http://gist.github.com/583048
5e68d18
Felix Geisendörfer Fix column ordering bug
Original patch by Bert Belder, see:
http://gist.github.com/583103

This patch also adds a unit test. I had to to move the packet.emit line
a little, as to make the unit test easier to produce.
7340394
Felix Geisendörfer Bump version c05ecc8
10 Readme.md
View
@@ -5,6 +5,13 @@
A node.js module implementing the
[MySQL protocol](http://forge.mysql.com/wiki/MySQL_Internals_ClientServer_Protocol).
+## Contributors
+
+* Bert Belder ([piscisaureus](http://github.com/felixge/node-mysql/commits/master?author=piscisaureus))
+* Alan Gutierrez ([bigeasy](http://github.com/felixge/node-mysql/commits/master?author=bigeasy))
+* Brian ([mscdex](http://github.com/felixge/node-mysql/commits/master?author=mscdex))
+* Cal Henderson ([iamcal](http://github.com/felixge/node-mysql/commits/master?author=iamcal))
+
## Sponsors
* [Joyent](http://www.joyent.com/)
@@ -185,10 +192,9 @@ parameter is provided which contains the information from the mysql OK packet.
At this point the module is ready to be tried out, but a lot of things are yet to be done:
+* Auto-cast mysql types into JS types
* Prepared Statements
-* Test using no Password
* Charsets handling
-* Import Error code constants
* ...
## License
4 lib/mysql/parser.js
View
@@ -515,10 +515,10 @@ Parser.prototype.write = function(buffer) {
break;
case Parser.COLUMN_VALUE_STRING:
var remaining = packet.columnLength - packet.index, read;
- if (i + remaining >= buffer.length) {
+ if (i + remaining > buffer.length) {
read = buffer.length - i;
- packet.emit('data', buffer.slice(i, buffer.length), remaining - read);
packet.index += read;
+ packet.emit('data', buffer.slice(i, buffer.length), remaining - read);
// the -1 offsets are because these values are also manipulated by the loop itself
packet.received += read - 1;
i = buffer.length;
2  package.json
View
@@ -1,5 +1,5 @@
{ "name" : "mysql"
-, "version": "0.4.0"
+, "version": "0.5.0"
, "dependencies": {"gently": ">=0.8.0"}
, "main" : "./lib/mysql"
}
1  test/common.js
View
@@ -12,6 +12,7 @@ global.TEST_CONFIG = {
};
global.TEST_TABLE = 'posts';
+global.TEST_FIXTURES = path.join(__dirname, 'fixture');
global.Gently = require('gently');
global.assert = require('assert');
54 test/fixture/columnia.sql
View
@@ -0,0 +1,54 @@
+CREATE TABLE `columnia` (
+ `f0` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `field0001` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `field002` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `field0000000003` bigint(20) unsigned DEFAULT NULL,
+ `field00004` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `field000000000005` bigint(20) unsigned DEFAULT NULL,
+ `field0000000000006` bigint(20) unsigned NOT NULL,
+ `field000007` text NOT NULL,
+ `field0000000008` text NOT NULL,
+ `field009` int(10) NOT NULL DEFAULT '0',
+ `field00010` text NOT NULL,
+ `field000000000011` text NOT NULL,
+ `field00000012` text NOT NULL,
+ `field0000013` text NOT NULL,
+ `field00000000000014` text NOT NULL,
+ `field0000000015` text NOT NULL,
+ `field000016` text NOT NULL,
+ `field000000000017` text NOT NULL,
+ `field0000000000000018` text NOT NULL,
+ `field0000000000019` text NOT NULL,
+ `field0000000000020` text NOT NULL,
+ `field00000000000021` text NOT NULL,
+ `field00000000022` text NOT NULL,
+ `field000000000000000023` text NOT NULL,
+ `field000000000000024` text NOT NULL,
+ `field000000000000025` text NOT NULL,
+ `field0000000000000026` text NOT NULL,
+ `field0000000000027` text NOT NULL,
+ `field00000028` bigint(20) unsigned NOT NULL,
+ `field000000029` tinyint(1) NOT NULL,
+ `field000030` tinyint(1) NOT NULL DEFAULT '0',
+ `field31` text NOT NULL,
+ `field00000032` bigint(20) unsigned NOT NULL,
+ `fi33` int(11) NOT NULL DEFAULT '0',
+ `field00000034` bigint(20) unsigned DEFAULT NULL,
+ `field000035` text NOT NULL,
+ `field0036` int(11) NOT NULL DEFAULT '0',
+ `field0000000000000000000037` text NOT NULL,
+ `field0000000000000000000038` text NOT NULL,
+ `field0000000000000000000000000039` text NOT NULL,
+ `field0000000000000000040` text NOT NULL,
+ `field00000000000000000041` text NOT NULL,
+ `field00000000000000000000042` text NOT NULL,
+ `field00000000000000000043` text NOT NULL,
+ `field00000000000000000044` text NOT NULL,
+ `field00000000000000000000000045` text NOT NULL,
+ `field00000000000000046` text NOT NULL,
+ `field000000000000000047` text NOT NULL,
+ `field000000000000000000048` text NOT NULL,
+ `field49` text NOT NULL,
+ `field50` int(11) NOT NULL,
+ PRIMARY KEY (`f0`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
1  test/simple/test-parser.js
View
@@ -343,6 +343,7 @@ test(function write() {
assert.equal(event, 'data');
assert.equal(val.toString(), 'Fine!');
assert.equal(remaining, 0);
+ assert.equal(packet.index, 0);
});
parser.write(new Buffer(' are you?\u0005Fine!'));
40 test/system/test-client-query-column-order.js
View
@@ -0,0 +1,40 @@
+require('../common');
+var REPEATS = 1000,
+ Client = require('mysql').Client,
+ client = Client(TEST_CONFIG),
+ fs = require('fs'),
+ gently = new Gently();
+
+client.connect();
+
+client.query('CREATE DATABASE '+TEST_DB, function(err) {
+ if (err && err.number != Client.ERROR_DB_CREATE_EXISTS) {
+ throw err;
+ }
+});
+client.query('USE '+TEST_DB);
+
+client.query('DROP TABLE IF EXISTS columnia');
+var fixture = fs.readFileSync(TEST_FIXTURES+'/columnia.sql', 'utf8');
+client.query(fixture);
+
+var finished = 0;
+for (var i = 0; i < REPEATS; i++) {
+ (function(i) {
+ var query = client.query("SHOW COLUMNS FROM columnia");
+
+ query.on('row', function(row) {
+ if (!row.Type) {
+ throw new Error('Column order mixed up after '+i+' queries.');
+ }
+ });
+
+ query.on('end', function() {
+ finished++;
+ if (finished === REPEATS) {
+ process.exit(0);
+ }
+ });
+ })(i);
+}
+

No commit comments for this range

Something went wrong with that request. Please try again.