不要怂,就是干,撸起袖子干!

Commit 0b78aee2 by Sascha Depold

removed old eager loading code

1 parent 19693357
Showing with 0 additions and 46 deletions
...@@ -132,8 +132,6 @@ module.exports = (function() { ...@@ -132,8 +132,6 @@ module.exports = (function() {
var optAttributes = [options.table + '.*'] var optAttributes = [options.table + '.*']
options.include.forEach(function(include) { options.include.forEach(function(include) {
//SELECT `UserWithNames`.*, `Tasks`.`title` AS `Tasks.title`, `Tasks`.`id` AS `Tasks.id`, `Tasks`.`createdAt` AS `Tasks.createdAt`, `Tasks`.`updatedAt` AS `Tasks.updatedAt`, `TaskFROM `UserWithNames` LEFT OUTER JOIN `Tasks` ON `Tasks`.`UserWithNameId`=`UserWithNames`.`id` WHERE `UserWithNames`.`id`=1;
//SELECT `Tasks`.*, `Workers`.`name` AS `Workers.name`, `Workers`.`id` AS `Workers.id`, `Workers`.`createdAt` AS `Workers.createdAt`, `Workers`.`updatedAt` AS `Workers.updatedAt` FROM `Tasks` LEFT OUTER JOIN `Workers` ON `Workers`.`WorkerId` = `Tasks`.`id` WHERE `Tasks`.`id`=1;
var attributes = Object.keys(include.daoFactory.attributes).map(function(attr) { var attributes = Object.keys(include.daoFactory.attributes).map(function(attr) {
var template = Utils._.template("`<%= table %>`.`<%= attr %>` AS `<%= as %>.<%= attr %>`") var template = Utils._.template("`<%= table %>`.`<%= attr %>` AS `<%= as %>.<%= attr %>`")
return template({ return template({
...@@ -155,50 +153,6 @@ module.exports = (function() { ...@@ -155,50 +153,6 @@ module.exports = (function() {
}) })
}) })
// for (var daoFactory in options.include) {
// if (options.include.hasOwnProperty(daoFactory)) {
// var dao = options.include[daoName]
// , daoFactory = dao.daoFactoryManager.getDAO(tableName, {
// attribute: 'tableName'
// })
// , _tableName = Utils.addTicks(dao.tableName)
// , association = dao.getAssociation(daoFactory)
// if (association.connectorDAO) {
// var foreignIdentifier = Object.keys(association.connectorDAO.rawAttributes).filter(function(attrName) {
// return (!!attrName.match(/.+Id$/) || !!attrName.match(/.+_id$/)) && (attrName !== association.identifier)
// })[0]
// query += ' LEFT OUTER JOIN ' + Utils.addTicks(association.connectorDAO.tableName) + ' ON '
// query += Utils.addTicks(association.connectorDAO.tableName) + '.'
// query += Utils.addTicks(foreignIdentifier) + '='
// query += Utils.addTicks(table) + '.' + Utils.addTicks('id')
// query += ' LEFT OUTER JOIN ' + Utils.addTicks(dao.tableName) + ' ON '
// query += Utils.addTicks(dao.tableName) + '.'
// query += Utils.addTicks('id') + '='
// query += Utils.addTicks(association.connectorDAO.tableName) + '.' + Utils.addTicks(association.identifier)
// } else {
// query += ' LEFT OUTER JOIN ' + Utils.addTicks(dao.tableName) + ' ON '
// query += Utils.addTicks(association.associationType === 'BelongsTo' ? dao.tableName : tableName) + '.'
// query += Utils.addTicks(association.identifier) + '='
// query += Utils.addTicks(association.associationType === 'BelongsTo' ? tableName : dao.tableName) + '.' + Utils.addTicks('id')
// }
// var aliasAssoc = daoFactory.getAssociationByAlias(daoName)
// , aliasName = !!aliasAssoc ? Utils.addTicks(daoName) : _tableName
// optAttributes = optAttributes.concat(
// Object.keys(dao.attributes).map(function(attr) {
// return '' +
// [_tableName, Utils.addTicks(attr)].join('.') +
// ' AS ' +
// Utils.addTicks([aliasName, attr].join('.'))
// })
// )
// }
// }
options.attributes = optAttributes.join(', ') options.attributes = optAttributes.join(', ')
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!