1--TEST-- 2PDO OCI: Inserts 10K with 1 number and 2 LOB columns (stress test) 3--SKIPIF-- 4<?php 5if (!extension_loaded('pdo') || !extension_loaded('pdo_oci')) die('skip not loaded'); 6if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request'); 7require(__DIR__.'/../../pdo/tests/pdo_test.inc'); 8PDOTest::skip(); 9?> 10--FILE-- 11<?php 12 13require(__DIR__ . '/../../pdo/tests/pdo_test.inc'); 14 15$db = PDOTest::factory(); 16 17$query = "begin execute immediate 'drop table pdo_oci_stream_2'; exception when others then if sqlcode <> -942 then raise; end if; end;"; 18$stmt = $db->prepare($query); 19$stmt->execute(); 20 21$query = "create table pdo_oci_stream_2 (id number, data1 blob, data2 blob)"; 22$stmt = $db->prepare($query); 23$stmt->execute(); 24 25function do_insert($db, $id, $data1, $data2) 26{ 27 $db->beginTransaction(); 28 $stmt = $db->prepare("insert into pdo_oci_stream_2 (id, data1, data2) values (:id, empty_blob(), empty_blob()) returning data1, data2 into :blob1, :blob2"); 29 $stmt->bindParam(':id', $id); 30 $stmt->bindParam(':blob1', $blob1, PDO::PARAM_LOB); 31 $stmt->bindParam(':blob2', $blob2, PDO::PARAM_LOB); 32 $blob1 = null; 33 $blob2 = null; 34 $stmt->execute(); 35 36 fwrite($blob1, $data1); 37 fclose($blob1); 38 fwrite($blob2, $data2); 39 fclose($blob2); 40 $db->commit(); 41} 42 43$a1 = str_repeat('a', 4086); 44$a2 = str_repeat('b', 4087); 45$a3 = str_repeat('c', 4088); 46$a4 = str_repeat('d', 4089); 47$a5 = str_repeat('e', 4090); 48$a6 = str_repeat('f', 4091); 49$a7 = str_repeat('g', 4092); 50$a8 = str_repeat('h', 4093); 51$a9 = str_repeat('i', 4094); 52$a10 = str_repeat('j', 4095); 53 54printf("Inserting 10000 Records ... "); 55for($i=0; $i<1000; $i++) { 56 do_insert($db, $i * 10 + 1, $a1, $a10); 57 do_insert($db, $i * 10 + 2, $a2, $a9); 58 do_insert($db, $i * 10 + 3, $a3, $a8); 59 do_insert($db, $i * 10 + 4, $a4, $a7); 60 do_insert($db, $i * 10 + 5, $a5, $a6); 61 do_insert($db, $i * 10 + 6, $a6, $a5); 62 do_insert($db, $i * 10 + 7, $a7, $a4); 63 do_insert($db, $i * 10 + 8, $a8, $a3); 64 do_insert($db, $i * 10 + 9, $a9, $a2); 65 do_insert($db, $i * 10 + 10, $a10, $a1); 66} 67printf("Done\n"); 68 69/* Cleanup is done in pdo_oci_stream_2b.phpt */ 70//$db->exec("drop table pdo_oci_stream_2"); 71 72?> 73--EXPECT-- 74Inserting 10000 Records ... Done 75