Get hold of the generated sql without executing the sql-query
Created by: cjnqt
I am looking for a way to get hold of the generated sql, without having to execute the query. Similar to this function.
Why?
- It would allow massive to be used as a query builder
- Useful for debugging (view what queries were generated)
- Makes it possible to create quick transactions:
db.query([
'BEGIN',
db.users.save({ name: 'Peter' }, {toString:true}),
db.users.save({ name: 'OtherGuy' }, {toString:true}),
'COMMIT'
].join(';'), function(...)
})
What do you think – good idea?
I tried an implementation (by setting the key 'toString' in the options object, as above) but it didn't work – I had totally missed how options are passed to the query runner. Do you have other ideas for an implementation?