Sannis/node-mysql-libmysqlclient — Issue #106: Async query problem - Query error #2014
Author: Somebi
Created: 2011-12-04 19:56:43+00:00
State: open

As i understand from code #2014 it says that buffer is not flushed from previous request.

This is my connection init method from bootstrap:

this.connectMysql=function(){

if(!this._config.mysql_config) {
return this;
}

var self=this;

/**
* Create connection
*/
this._mysql_conn=this.meryl._mysql_conn=this.meryl.mysql.createConnectionSync();

this._mysql_conn.connectSync(
this._config.mysql_config.host,
this._config.mysql_config.user,
this._config.mysql_config.password,
this._config.mysql_config.database,
null, // default picked, 3306 or 3307
this._config.mysql_config.socket
);

/**
* Check connection status
*/
if (!this._mysql_conn.connectedSync()) {
sys.puts("Connection error " + this._mysql_conn.connectErrno + ": " + this._mysql_conn.connectError);
process.exit(1);
}

/**
* Close connection on exit
*/
process.on('exit', function () {
self._mysql_conn.closeSync();
});

/**
* Set charset
*/
this._mysql_conn.realQuerySync('SET NAMES UTF8');

return this;
};

This is the piece of my model:

s.meryl._mysql_conn.query(
statements.join(' UNION ALL ')
,function(err,res){

if (err) {
console.log('Failed at GetAds.js first query');
throw err;
}

res.fetchAll(function(err,rows){
if (err) {
console.log('Failed at GetAds.js first query fetch');
throw err;
}

/** Pass data to cache controller **/
s.meryl.cache({key:'mainpage1_'+s.meryl.clang,data:rows});

/** Return data to callback **/
o.callback({data:rows});

});

}
);

Using lastest v0.6.3 version of node. Don't know if this is an issue. Before upgrade used v0.3.3pre i think. Installed your v1.2.9 module from npm.

Before upgrade everything worked fine.

I'm currently working on a project, so it's very important to me.
Can you please look into it. :)

Thanks for module btw ;)