@@ -404,7 +404,7 @@ class GenericQueryBuilder {
404404
405405 escape = ( typeof escape === 'boolean' ? escape : true ) ;
406406
407- if ( typeof key === 'string' && typeof value === 'object' && Array . isArray ( value ) && value . length > 0 ) {
407+ if ( typeof key === 'string' && Array . isArray ( value ) && value . length > 0 ) {
408408 return this . _where_in ( key , value , false , 'AND ' ) ;
409409 }
410410 return this . _where ( key , value , 'AND ' , escape ) ;
@@ -422,7 +422,7 @@ class GenericQueryBuilder {
422422 _where ( key , value = null , type = 'AND ' , escape = true ) {
423423 escape = ( typeof escape === 'boolean' ? escape : true ) ;
424424
425- // Must be an object or a string
425+ // If key is not an object....
426426 if ( Object . prototype . toString . call ( key ) !== Object . prototype . toString . call ( { } ) ) {
427427 // If it's not an object, it must be a string
428428 if ( typeof key !== 'string' ) {
@@ -467,15 +467,18 @@ class GenericQueryBuilder {
467467 key = key_array ;
468468 }
469469
470- if ( Object . keys ( key ) . length == 0 ) {
470+ // Fail if its an empty object
471+ if ( Object . keys ( key ) . length === 0 ) {
471472 throw new Error ( "where(): You haven't provided any key value pairs to limit the resultset by." ) ;
472473 }
473474
475+ // If an object is supplied...
474476 for ( let k in key ) {
475477 let v = key [ k ] ;
476478
477- if ( typeof v === 'object' && Array . isArray ( v ) && v . length > 0 ) {
478- return this . _where_in ( k , v , false , type , escape ) ;
479+ if ( Array . isArray ( v ) && v . length > 0 ) {
480+ this . _where_in ( k , v , false , type , escape ) ;
481+ continue ;
479482 }
480483
481484 const prefix = ( this . where_array . length == 0 ? '' : type ) ;
@@ -1300,9 +1303,9 @@ class GenericQueryBuilder {
13001303 this . from ( table ) ;
13011304 }
13021305
1303- if ( Object . prototype . toString . call ( where ) === Object . prototype . toString . call ( { } ) ) {
1304- if ( Object . keys ( where ) . length == 0 ) {
1305- throw new Error ( "where(): The object you provided to limit the deletion of rows is empty." ) ;
1306+ if ( Object . prototype . toString . call ( where ) === Object . prototype . toString . call ( { } ) && where !== null ) {
1307+ if ( Object . keys ( where ) . length === 0 ) {
1308+ throw new Error ( "where(): The object you provided to limit the deletion of rows is empty. Provide NULL if you need to an empty value. " ) ;
13061309 }
13071310 else {
13081311 this . where ( where ) ;
0 commit comments