mysql query specific options
Closed this issue · 3 comments
Hi,
There are query level options in mysql that can be set for a specific query, e.g. in a query involving joins, nestTables is such an option.
connection.query({ sql: 'xxx', values: 'yyy', nestTables: true }, cb)
By modifying the adapter code, I can set nestTables globally (right after calling createQuery) , but I can't find a clean way to do this on a per query basis. Any suggestions?
Because any-db delegates query creation to the mysql driver, I think you should be able to just query in the same way. For example, this should work:
require('any-db')
.createPool('mysql://')
.query({sql: 'xxx', values: 'xxx', nestTables: true}, function (err, res) { ... })
If it doesn't work that way can you include a stack trace and I'll see if I can make it happen.
Yes, thats how I am doing it right now. Thanks
I am using anydb-sql, which wraps on anydb, so I guess I really should be changing the API there to let it pass such options in its own APIs.
Ah, yes in that case it would be up to anydb-sql to send the correct parameters down to any-db.