File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -180,9 +180,6 @@ var Query = Node.define({
180180 var self = this ;
181181
182182 var args = sliced ( arguments ) ;
183- if ( o . length == 0 ) {
184- o = { } ;
185- }
186183 // object literal
187184 if ( arguments . length === 1 && ! o . toNode && ! o . forEach ) {
188185 args = [ ] ;
Original file line number Diff line number Diff line change @@ -185,7 +185,12 @@ Table.prototype.subQuery = function(alias) {
185185
186186Table . prototype . insert = function ( ) {
187187 var query = new Query ( this ) ;
188- query . insert . apply ( query , arguments ) ;
188+ if ( arguments [ 0 ] . length == 0 ) {
189+ query . select . call ( query , this . star ( ) ) ;
190+ query . where . apply ( query , [ "1=2" ] ) ;
191+ } else {
192+ query . insert . apply ( query , arguments ) ;
193+ }
189194 return query ;
190195} ;
191196
Original file line number Diff line number Diff line change @@ -409,8 +409,8 @@ Harness.test({
409409 query : post . insert ( [ ] ) ,
410410
411411 mysql : {
412- text : 'INSERT INTO `post` () VALUES ( )' ,
413- string : 'INSERT INTO `post` () VALUES ( )'
412+ text : 'SELECT `post`.* FROM `post` WHERE (1=2 )' ,
413+ string : 'SELECT `post`.* FROM `post` WHERE (1=2 )'
414414 } ,
415415 params : [ ]
416416} ) ;
You can’t perform that action at this time.
0 commit comments