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

Commit 640e1eca by Joshua Perry

1.7 Error on empty result from table definition queries

1 parent a3aa0824
Showing with 8 additions and 1 deletions
...@@ -369,7 +369,14 @@ module.exports = (function() { ...@@ -369,7 +369,14 @@ module.exports = (function() {
} }
self.sequelize.query(sql, null, { raw: true }).success(function(data) { self.sequelize.query(sql, null, { raw: true }).success(function(data) {
emitter.emit('success', data) if(Utils._.isEmpty(data)) {
// If no data is returned from the query, then the table name may be wrong.
// Query generators that use information_schema for retrieving table info will just return an empty result set,
// it will not throw an error like built-ins do (e.g. DESCRIBE on MySql).
emitter.emit('error', 'No description found for "' + tableName + '" table. Check the table name and schema; remember, they _are_ case sensitive.')
} else {
emitter.emit('success', data)
}
}).error(function(err) { }).error(function(err) {
emitter.emit('error', err) emitter.emit('error', err)
}).on('sql', function(sql) { }).on('sql', function(sql) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!