@@ -87,25 +87,33 @@ class QueryExec extends QueryBuilder {
8787 }
8888
8989 insert ( table , set , cb , ignore , suffix ) {
90- const sql = this . _insert ( table , set , ignore , suffix ) ;
90+ const sql = this . _insert ( table , set , ignore , suffix ) ;
9191 this . reset_query ( sql ) ;
92- this . _exec ( sql , cb ) ;
92+ this . _exec ( sql , cb ) ;
9393 }
9494
95- insert_ignore ( table , set , on_dupe , cb ) {
95+ insert_ignore ( table , set , on_dupe , cb ) {
9696 if ( typeof on_dupe === 'function' ) {
9797 cb = on_dupe ;
9898 on_dupe = null ;
9999 }
100- const sql = this . _insert_ignore ( table , set , on_dupe ) ;
100+ const sql = this . _insert_ignore ( table , set , on_dupe ) ;
101101 this . reset_query ( sql ) ;
102102 this . _exec ( sql , cb ) ;
103103 }
104104
105- insert_batch ( table , set , cb ) {
106- const sql = this . _insert_batch ( table , set ) ;
105+ insert_batch ( table , set , ignore , on_dupe , cb ) {
106+ if ( typeof ignore === 'function' ) {
107+ cb = ignore ;
108+ ignore = null ;
109+ }
110+ else if ( typeof on_dupe === 'function' ) {
111+ cb = on_dupe ;
112+ on_dupe = null ;
113+ }
114+ const sql = this . _insert_batch ( table , set , ignore , on_dupe ) ;
107115 this . reset_query ( sql ) ;
108- this . _exec ( sql , cb ) ;
116+ this . _exec ( sql , cb ) ;
109117 }
110118
111119 update ( table , set , where , cb ) {
@@ -121,9 +129,9 @@ class QueryExec extends QueryBuilder {
121129 where = null ;
122130 }
123131
124- const sql = this . _update ( table , set , where ) ;
132+ const sql = this . _update ( table , set , where ) ;
125133 this . reset_query ( sql ) ;
126- this . _exec ( sql , cb ) ;
134+ this . _exec ( sql , cb ) ;
127135 }
128136
129137 // TODO: Write this complicated-ass function
@@ -140,7 +148,7 @@ class QueryExec extends QueryBuilder {
140148 where = null ;
141149 }
142150
143- const sqls = this . _update_batch ( table , set , index , where ) ;
151+ const sqls = this . _update_batch ( table , set , index , where ) ;
144152 const results = null ;
145153 const errors = [ ] ;
146154
0 commit comments