This file is a manually maintained list of changes for each release. Feel free to add your changes here when sending pull requests. Also send corrections if you spot any mistakes.
- Add code
POOL_NOEXIST
in PoolCluster error #846
- Fix pool leaking connections after
conn.changeUser
#833
- Add database errors to error constants
- Add global errors to error constants
- Throw when calling
conn.release
multiple times #824 #827 - Update known error codes
- Accept MySQL charset (like
UTF8
orUTF8MB4
) incharset
option #808 - Accept pool options in connection string to
mysql.createPool
#811 - Clone connection config for new pool connections
- Default
connectTimeout
to 2 minutes - Reject unauthorized SSL connections (use
ssl.rejectUnauthorized
to override) #816 - Return last error when PoolCluster exhausts connection retries #818
- Remove connection from pool after
conn.changeUser
is released #806 - Throw on unknown SSL profile name #817
- User newer TLS functions when available #809
- Use indexOf instead of for loops removing conn from pool #611
- Make callback to
pool.query
optional likeconn.query
#585 - Prevent enqueuing sequences after fatal error #400
- Fix geometry parser for empty fields #742
- Accept lower-case charset option
- Throw on unknown charset option #789
- Update known charsets
- Remove console.warn from PoolCluster #744
- Fix
pool.end
to handle queued connections #797 - Fix
pool.releaseConnection
to keep connection queue flowing #797 - Fix SSL handshake error to be catchable #800
- Add
connection.threadId
to get MySQL connection ID #602 - Ensure
pool.getConnection
retrieves good connections #434 #557 #778 - Fix pool cluster wildcard matching #627
- Pass query values through to
SqlString.format
#590
- fix authentication w/password failure for node.js 0.10.5 #746 #752
- fix authentication w/password TypeError exception for node.js 0.10.0-0.10.4 #747
- fix specifying
values
inconn.query({...}).on(...)
pattern #755 - fix long stack trace to include the
pool.query(...)
call #715
- crypto.createHash fix for node.js < 11 #735
- Add
connectTimeout
option to specify a timeout for establishing a connection #726 - SSL support #481
- internal parser speed improvement #702
- domains support
- 'trace' connection option to control if long stack traces are generated #713 #710 #439
- stream improvements:
- node 0.8 support #692
- Emit 'close' events from query streams #688
- encoding fix in streaming LOAD DATA LOCAL INFILE #670
- Doc improvements
- Streaming LOAD DATA LOCAL INFILE #668
- Doc improvements
- Transaction support
- Expose SqlString.format as mysql.format()
- Many bug fixes
- Better support for dates in local time zone
- Doc improvements
- Add query to pool to execute queries directly using the pool
- Pool option to set queue limit
- Pool sends 'connection' event when it opens a new connection
- Added stringifyObjects option to treat input as strings rather than objects (#501)
- Support for poolClusters
- Datetime improvements
- Bug fixes
- Switch to old mode for Streams 2 (Node.js v 0.10.x)
- Add stream method to Query Wraps events from the query object into a node v0.10.x Readable stream
- DECIMAL should also be treated as big number
- Removed slow unnecessary stack access
- Added charsets
- Added bigNumberStrings option for forcing BIGINT columns as strings
- Changes date parsing to return String if not a valid JS Date
- Adds support for ?? escape sequence to escape identifiers
- Changes Auth.token() to force password to be in binary, not utf8 (#378)
- Restrict debugging by packet types
- Add 'multipleStatements' option tracking to ConnectionConfig. Fixes GH-408
- Changes Pool to handle 'error' events and dispose connection
- Allows db.query({ sql: "..." }, [ val1, ... ], cb); (#390)
- Improved documentation
- Bug fixes
- Add connection pooling (#351)
- Add supportBigNumbers option (#381, #382)
- Accept prebuilt Query object in connection.query
- Bug fixes
- Add mysql.escapeId to escape identifiers (closes #342)
- Allow custom escaping mode (config.queryFormat)
- Convert DATE columns to configured timezone instead of UTC (#332)
- Convert LONGLONG and NEWDECIMAL to numbers (#333)
- Fix Connection.escape() (fixes #330)
- Changed Readme ambiguity about custom type cast fallback
- Change typeCast to receive Connection instead of Connection.config.timezone
- Fix drain event having useless err parameter
- Add Connection.statistics() back from v0.9
- Add Connection.ping() back from v0.9
- Fix some OOB errors on resume()
- Fix quick pause() / resume() usage
- Properly parse host denied / similar errors
- Add Connection.ChangeUser functionality
- Make sure changeUser errors are fatal
- Enable formatting nested arrays for bulk inserts
- Add Connection.escape functionality
- Renamed 'close' to 'end' event
- Return parsed object instead of Buffer for GEOMETRY types
- Allow nestTables inline (using a string instead of a boolean)
- Check for ZEROFILL_FLAG and format number accordingly
- Add timezone support (default: local)
- Add custom typeCast functionality
- Export mysql column types
- Add connection flags functionality (#237)
- Exports drain event when queue finishes processing (#272, #271, #306)
- Implement support for
LOAD DATA LOCAL INFILE
queries (#182). - Support OLD_PASSWORD() accounts like 0.9.x did. You should still upgrade any user accounts in your your MySQL user table that has short (16 byte) Password values. Connecting to those accounts is not secure. (#204)
- Ignore function values when escaping objects, allows to use RowDataPacket objects as query arguments. (Alex Gorbatchev, #213)
- Handle initial error packets from server such as
ER_HOST_NOT_PRIVILEGED
. - Treat
utf8\_bin
as a String, not Buffer. (#214) - Handle empty strings in first row column value. (#222)
- Honor Connection#nestTables setting for queries. (#221)
- Remove
CLIENT_INTERACTIVE
flag from config. Improves #225. - Improve docs for connections settings.
- Implement url string support for Connection configs.
- Specify escaping before for NaN / Infinity (they are as unquoted constants).
- Support for unix domain socket connections (use: {socketPath: '...'}).
- Fix type casting for NULL values for Date/Number fields
- Add
fields
argument toquery()
as well as'fields'
event. This is similar to what was available in 0.9.x. - Support connecting to the sphinx searchd daemon as well as MariaDB (#199).
- Implement long stack trace support, will be removed / disabled if the node core ever supports it natively.
- Implement
nestTables
option for queries, allows fetching JOIN result sets with overlapping column names. - Fix ? placeholder mechanism for values containing '?' characters (#205).
- Detect when
connect()
is called more than once on a connection and provide the user with a good error message for it (#204). - Switch to
UTF8_GENERAL_CI
(previouslyUTF8_UNICODE_CI
) as the default charset for all connections to avoid strange MySQL performance issues (#200), and also make the charset user configurable. - Fix BLOB type casting for
TINY_BLOB
,MEDIUM_BLOB
andLONG_BLOB
. - Add support for sending and receiving large (> 16 MB) packets.
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 theQuery
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.
- Escape array values so they produce sql arrays (Roger Castells, Colin Smith)
- docs: mention mysql transaction stop gap solution (Blake Miner)
- docs: Mention affectedRows in FAQ (Michael Baldwin)
- Fix #142 Driver stalls upon reconnect attempt that's immediately closed
- Add travis build
- Switch to urun as a test runner
- Switch to utest for unit tests
- Remove fast-or-slow dependency for tests
- Split integration tests into individual files again
- Expose package.json as
mysql.PACKAGE
(#104)
- Set default
client.user
to root - Fix #91: Client#format should not mutate params array
- Fix #94: TypeError in client.js
- Parse decimals as string (vadimg)
- The underlaying socket connection is now managed implicitly rather than explicitly.
- Check the [upgrading guide][] for a full list of changes.
- Fix issue #49 /
client.escape()
throwing exceptions on objects. (Nick Payne) - Drop < v0.4.x compatibility. From now on you need node v0.4.x to use this module.
These releases were done before maintaining this file: