File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -447,10 +447,12 @@ var Base = Class.extend({
447447
448448 insert : function ( tableName , valueArray , callback ) {
449449 var columnNameArray = { } ;
450+ var numValueColumns ;
450451
451452 if ( arguments . length > 3 || Array . isArray ( callback ) ) {
452453 columnNameArray = valueArray ;
453454 valueArray = callback ;
455+ numValueColumns = Array . isArray ( valueArray [ 0 ] ) ? valueArray [ 0 ] . length : valueArray . length ;
454456 } else {
455457 var names ;
456458 if ( Array . isArray ( valueArray ) ) {
@@ -462,9 +464,11 @@ var Base = Class.extend({
462464 for ( var i = 0 ; i < names . length ; ++ i ) {
463465 columnNameArray [ names [ i ] ] = names [ i ] ;
464466 }
467+
468+ numValueColumns = valueArray . length ;
465469 }
466470
467- if ( columnNameArray . length !== valueArray . length ) {
471+ if ( columnNameArray . length !== numValueColumns ) {
468472 return Promise . reject (
469473 new Error ( 'The number of columns does not match the number of values.' )
470474 ) . nodeify ( callback ) ;
You can’t perform that action at this time.
0 commit comments