lib/Migration/Version0017Date20200202112901.php 1 location
|
@@ 166-187 (lines=22) @@
|
| 163 |
|
} |
| 164 |
|
|
| 165 |
|
|
| 166 |
|
protected function copyTable($orig, $dest) { |
| 167 |
|
$connection = \OC::$server->getDatabaseConnection(); |
| 168 |
|
$qb = $connection->getQueryBuilder(); |
| 169 |
|
|
| 170 |
|
$qb->select('*') |
| 171 |
|
->from($orig); |
| 172 |
|
|
| 173 |
|
$result = $qb->execute(); |
| 174 |
|
while ($row = $result->fetch()) { |
| 175 |
|
|
| 176 |
|
$copy = $connection->getQueryBuilder(); |
| 177 |
|
$copy->insert($dest); |
| 178 |
|
$ak = array_keys($row); |
| 179 |
|
foreach ($ak as $k) { |
| 180 |
|
if ($row[$k] !== null) { |
| 181 |
|
$copy->setValue($k, $copy->createNamedParameter($row[$k])); |
| 182 |
|
} |
| 183 |
|
} |
| 184 |
|
$copy->execute(); |
| 185 |
|
} |
| 186 |
|
|
| 187 |
|
} |
| 188 |
|
|
| 189 |
|
} |
| 190 |
|
|
lib/Migration/Version0017Date20200202112903.php 1 location
|
@@ 239-260 (lines=22) @@
|
| 236 |
|
} |
| 237 |
|
|
| 238 |
|
|
| 239 |
|
protected function copyTable($orig, $dest) { |
| 240 |
|
$connection = \OC::$server->getDatabaseConnection(); |
| 241 |
|
$qb = $connection->getQueryBuilder(); |
| 242 |
|
|
| 243 |
|
$qb->select('*') |
| 244 |
|
->from($orig); |
| 245 |
|
|
| 246 |
|
$result = $qb->execute(); |
| 247 |
|
while ($row = $result->fetch()) { |
| 248 |
|
|
| 249 |
|
$copy = $connection->getQueryBuilder(); |
| 250 |
|
$copy->insert($dest); |
| 251 |
|
$ak = array_keys($row); |
| 252 |
|
foreach ($ak as $k) { |
| 253 |
|
if ($row[$k] !== null) { |
| 254 |
|
$copy->setValue($k, $copy->createNamedParameter($row[$k])); |
| 255 |
|
} |
| 256 |
|
} |
| 257 |
|
$copy->execute(); |
| 258 |
|
} |
| 259 |
|
|
| 260 |
|
} |
| 261 |
|
|
| 262 |
|
|
| 263 |
|
} |