nuodb/nuodb-drivers — pull request #19 by thepumpkin1979 (2012-10-15 06:59:58+00:00)
Title: [query] Execute NuoDB::Statement as Update or Query accordingly allowing...

Hi,

This patch allows the driver to perform statements other than select by using executeUpdate when the SQL Query constructed by node-db doesn't begin with SELECT.

The implementation follows the standard for node-db when executing scalar operations like DELETE and UPDATE returning an object with counts instead of a node-db resultset.

```javascript
{
affected: Number // number of rows affected by DELETE or UPDATE statements.
warning: Number // number of warnings, I guess we wouldn't use it for NuoDB
id: Number // id of the sequence, serial or PK created by INSERT.
}
```

Example:

```javascript
db.query().delete().from("names").where("name = ?", ["Hello World"]).execute(function(err) {
if (err) {
return console.log('ERROR: ' + err);
}
console.log("deleted", arguments);
});
```

```
>> deleted { '0': null, '1': { id: 0, affected: 1, warning: 0 } }
```