Guest User

Untitled

a guest
Jun 14th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. /*
  2. Test with the table from test.sql
  3. */
  4.  
  5. require.paths.push(__dirname+'/lib');
  6.  
  7. var Client = require('mysql').Client,
  8. client = new Client();
  9.  
  10. client.user = 'root';
  11. client.password = null;
  12. client.database = 'test';
  13.  
  14. client.connect(function(error) {
  15. if (error) throw error;
  16. });
  17.  
  18. client.on('error', function(error) {
  19. throw error;
  20. });
  21.  
  22. var tests = 10000,
  23. finished = 0,
  24. good = {};
  25.  
  26. for (var i = 0; i < tests; i++) {
  27. var query = client.query("SHOW COLUMNS FROM test");
  28.  
  29. query.on('row', function(row) {
  30. if (!row.Type) {
  31. console.log("Baaaad:");
  32. console.log(row);
  33. console.log("Good would have been:");
  34. console.log(good[row.Field]);
  35. } else {
  36. good[row.Field] = row;
  37. }
  38. });
  39.  
  40. query.on('end', function() {
  41. if (++finished === tests) {
  42. process.exit();
  43. }
  44. });
  45. }
Add Comment
Please, Sign In to add comment