@@ -169,6 +169,34 @@ public function testBindParamProcessesStream(): void
169169 $ this ->assertBlobContains ('test ' );
170170 }
171171
172+ public function testBlobBindingDoesNotOverwritePrevious (): void
173+ {
174+ $ table = new Table ('blob_table ' );
175+ $ table ->addColumn ('id ' , 'integer ' );
176+ $ table ->addColumn ('blobcolumn1 ' , 'blob ' , ['notnull ' => false ]);
177+ $ table ->addColumn ('blobcolumn2 ' , 'blob ' , ['notnull ' => false ]);
178+ $ table ->setPrimaryKey (['id ' ]);
179+ $ this ->dropAndCreateTable ($ table );
180+
181+ $ params = ['test1 ' , 'test2 ' ];
182+ $ this ->connection ->executeStatement (
183+ 'INSERT INTO blob_table(id, blobcolumn1, blobcolumn2) VALUES (1, ?, ?) ' ,
184+ $ params ,
185+ [ParameterType::LARGE_OBJECT , ParameterType::LARGE_OBJECT ],
186+ );
187+
188+ $ blobs = $ this ->connection ->fetchNumeric ('SELECT blobcolumn1, blobcolumn2 FROM blob_table ' );
189+ self ::assertIsArray ($ blobs );
190+
191+ $ actual = [];
192+ foreach ($ blobs as $ blob ) {
193+ $ blob = Type::getType ('blob ' )->convertToPHPValue ($ blob , $ this ->connection ->getDatabasePlatform ());
194+ $ actual [] = stream_get_contents ($ blob );
195+ }
196+
197+ self ::assertEquals (['test1 ' , 'test2 ' ], $ actual );
198+ }
199+
172200 private function assertBlobContains (string $ text ): void
173201 {
174202 [, $ blobValue ] = $ this ->fetchRow ();
0 commit comments