Node.js Error "Cannot switch to old mode now." with MySQL NPM -


node.js throws below error when issuing query via mysql npm.

_stream_readable.js:664 throw new error('cannot switch old mode now.');  error: cannot switch old mode now. @ emitdataevents (_stream_readable.js:664:11) @ socket.readable.resume (_stream_readable.js:649:3) 

sample code throws error:

query  = mysqlcli.query( 'select * foo bar = 1' ); results = [];  mysqlcli.resume();  query    .on( 'error', function ( err ) {      console.log( 'bad things: ', err );    })    .on( 'result', function ( row ) {        results.push( row );    })    .on( 'end', function (){      mysqlcli.pause();      datahandler( results );    }); 

this took quite bit of troubleshooting, ultimate fix remove both mysqlcli.pause(); , mysqlcli.resume();. odd thing problem code executed fine on windows server 2003 once cloned via git broke under centos 5.9 (rhel).


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -