MySQL v2.0.0-alpha Release Notes

Release Date: 2012-05-15 // almost 12 years ago
  • ๐Ÿš€ This release is a rewrite. You should carefully test your application after ๐Ÿš€ upgrading to avoid problems. This release features many improvements, most importantly:

    • ๐Ÿ“œ ~5x faster than v0.9.x for parsing query results
    • ๐Ÿ‘Œ Support for pause() / resume() (for streaming rows)
    • ๐Ÿ‘Œ Support for multiple statement queries
    • ๐Ÿ‘Œ Support for stored procedures
    • ๐Ÿ‘Œ Support for transactions
    • ๐Ÿ‘Œ Support for binary columns (as blobs)
    • Consistent & well documented error handling
    • A new Connection class that has well defined semantics (unlike the old Client class).
    • Convenient escaping of objects / arrays that allows for simpler query construction
    • A significantly simpler code base
    • ๐Ÿ›  Many bug fixes & other small improvements (Closed 62 out of 66 GitHub issues)

    โฌ†๏ธ Below are a few notes on the upgrade process itself:

    The first thing you will run into is that the old Client class is gone and has been replaced with a less ambitious Connection class. So instead of mysql.createClient(), you now have to:

    var mysql      = require('mysql');
    var connection = mysql.createConnection({
      host     : 'localhost',
      user     : 'me',
      password : 'secret',
    });
    
    connection.query('SELECT 1', function(err, rows) {
      if (err) throw err;
    
      console.log('Query result: ', rows);
    });
    
    connection.end();
    

    The new Connection class does not try to handle re-connects, please study the Server disconnects section in the new Readme.

    Other than that, the interface has stayed very similar. Here are a few things to check out so:

    • BIGINT's are now cast into strings
    • Binary data is now cast to buffers
    • The 'row' event on the Query object is now called 'result' and will also be emitted for queries that produce an OK/Error response.
    • Error handling is consistently defined now, check the Readme
    • Escaping has become more powerful which may break your code if you are currently using objects to fill query placeholders.
    • Connections can now be established explicitly again, so you may wish to do so if you want to handle connection errors specifically.

    That should be most of it, if you run into anything else, please send a patch or open an issue to improve this document.