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