@@ -250,13 +250,13 @@ public function testInsertBulk(): void
250
250
if ($ options ->binarySelectedAsStream || $ options ->nativeBoolColumns || $ options ->floatSelectedAsString ) {
251
251
/** @var array{weight: float|string, is_disabled: int|bool, uuid: string|resource} $row */
252
252
foreach ($ rows as &$ row ) {
253
- if (! is_float ( $ row [ ' weight ' ]) ) {
253
+ if ($ options -> floatSelectedAsString ) {
254
254
$ row ['weight ' ] = (float ) $ row ['weight ' ];
255
255
}
256
- if (! is_int ( $ row [ ' is_disabled ' ]) ) {
256
+ if ($ options -> nativeBoolColumns ) {
257
257
$ row ['is_disabled ' ] = (int ) $ row ['is_disabled ' ];
258
258
}
259
- if (! is_string ( $ row [ ' uuid ' ]) ) {
259
+ if ($ options -> binarySelectedAsStream ) {
260
260
/** @psalm-suppress InvalidArgument */
261
261
$ row ['uuid ' ] = stream_get_contents ($ row ['uuid ' ]);
262
262
}
@@ -274,12 +274,13 @@ public function testInsertBulk(): void
274
274
$ userId = $ ids [0 ];
275
275
$ set = ['uuid ' => $ peachySql ->makeBinaryParam ($ newUuid )];
276
276
$ peachySql ->updateRows ($ this ->table , $ set , ['user_id ' => $ userId ]);
277
- /** @var array{uuid: string|resource} $updatedRow */
278
277
$ updatedRow = $ peachySql ->selectFrom ("SELECT uuid FROM {$ this ->table }" )
279
278
->where (['user_id ' => $ userId ])->query ()->getFirst ();
280
279
281
- if (!is_string ($ updatedRow ['uuid ' ])) {
282
- $ updatedRow ['uuid ' ] = stream_get_contents ($ updatedRow ['uuid ' ]); // needed for PostgreSQL
280
+ if ($ updatedRow === null ) {
281
+ throw new \Exception ('Failed to select updated UUID ' );
282
+ } elseif ($ options ->binarySelectedAsStream && is_resource ($ updatedRow ['uuid ' ])) {
283
+ $ updatedRow ['uuid ' ] = stream_get_contents ($ updatedRow ['uuid ' ]);
283
284
}
284
285
285
286
$ this ->assertSame ($ newUuid , $ updatedRow ['uuid ' ]);
0 commit comments