Skip to content

Instantly share code, notes, and snippets.

@piscisaureus
Created September 16, 2010 19:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save piscisaureus/583048 to your computer and use it in GitHub Desktop.
Save piscisaureus/583048 to your computer and use it in GitHub Desktop.
/*
Test with the table from test.sql
*/
require.paths.push(__dirname+'/lib');
var Client = require('mysql').Client,
client = new Client();
client.user = 'root';
client.password = null;
client.database = 'test';
client.connect(function(error) {
if (error) throw error;
});
client.on('error', function(error) {
throw error;
});
var tests = 10000,
finished = 0,
good = {};
for (var i = 0; i < tests; i++) {
var query = client.query("SHOW COLUMNS FROM test");
query.on('row', function(row) {
if (!row.Type) {
console.log("Baaaad:");
console.log(row);
console.log("Good would have been:");
console.log(good[row.Field]);
} else {
good[row.Field] = row;
}
});
query.on('end', function() {
if (++finished === tests) {
process.exit();
}
});
}
CREATE TABLE `test` (
`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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment