Skip to content

Commit 39a3e86

Browse files
committed
Table::select() creates *-select by default
Test case provided.
1 parent 85b3a96 commit 39a3e86

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

lib/table.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,11 @@ Table.prototype.count = function(alias) {
105105
Table.prototype.select = function() {
106106
//create the query and pass it off
107107
var query = new Query(this);
108-
query.select.apply(query, arguments);
108+
if (arguments.length === 0) {
109+
query.select.call(query, this.star());
110+
} else {
111+
query.select.apply(query, arguments);
112+
}
109113
return query;
110114
};
111115

test/table-tests.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ suite('table', function() {
3636
assert.equal(sel.type, 'QUERY');
3737
});
3838

39+
test('creates *-query if no args is provided to select()', function() {
40+
var sel = table.select();
41+
assert.ok(sel.nodes[0].nodes[0].star);
42+
});
43+
3944
test('can be defined', function() {
4045
var user = Table.define({
4146
name: 'user',

0 commit comments

Comments
 (0)