As I know due non-blocking I/O theory everything should be in callback.

So Im confused as in example [felixge/node-mysql](https://github.com/felixge/node-mysql/#establishing-connections)

```
connection.connect();

connection.query('SELECT 1 + 1 AS solution', function(err, rows, fields) {
  if (err) throw err;

  console.log('The solution is: ', rows[0].solution);
});

connection.end();

```

But I think thats wrong example, cause .end() may happen before connection established.

Can some give me right example to connect, query and end mysql connection.

```
connection.connect(function(err) {
    if (err) {
        console.error('error connecting: ' + err.stack);
        return;
    }

    // As I understand every "query" should happen here
});

```