diff --git a/lib/adapter.js b/lib/adapter.js index 84839a54..e8a3ed1e 100644 --- a/lib/adapter.js +++ b/lib/adapter.js @@ -904,7 +904,18 @@ module.exports = (function() { var tableName = collectionName; // Build find query - var query = sql.selectQuery(tableName, options); + var schema = connectionObject.schema; + var _query; + + var sequel = new Sequel(schema, sqlOptions); + + // Build a query for the specific query strategy + try { + _query = sequel.find(collectionName, options); + } catch(e) { + return cb(e); + } + var query = _query.query[0]; // Run query log('MySQL.stream: ', query);