File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -2130,12 +2130,28 @@ protected function formatValues(array $values): array
2130
2130
/**
2131
2131
* Compiles batch insert strings and runs the queries
2132
2132
*
2133
- * @param array|object|null $set a dataset
2133
+ * @param array|BaseBuilder|RawSql| object|null $set a dataset
2134
2134
*
2135
2135
* @return false|int|string[] Number of rows inserted or FALSE on failure, SQL array when testMode
2136
2136
*/
2137
2137
public function insertBatch ($ set = null , ?bool $ escape = null , int $ batchSize = 100 )
2138
2138
{
2139
+ $ this ->fromQuery ($ set );
2140
+
2141
+ if (isset ($ this ->QBOptions ['fromQuery ' ])) {
2142
+ $ sql = $ this ->_insertBatch ($ this ->QBFrom [0 ], $ this ->QBKeys , []);
2143
+
2144
+ if ($ sql === '' ) {
2145
+ return false ; // @codeCoverageIgnore
2146
+ }
2147
+
2148
+ $ this ->db ->query ($ sql , null , false );
2149
+
2150
+ $ this ->resetWrite ();
2151
+
2152
+ return $ this ->testMode ? $ sql : $ this ->db ->affectedRows ();
2153
+ }
2154
+
2139
2155
if ($ set !== null && $ set !== []) {
2140
2156
$ this ->setData ($ set , $ escape );
2141
2157
}
You can’t perform that action at this time.
0 commit comments