pecl_bug8816.phpt 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. --TEST--
  2. PECL Bug #8816 (issue in php_oci_statement_fetch with more than one piecewise column)
  3. --EXTENSIONS--
  4. oci8
  5. --SKIPIF--
  6. <?php
  7. $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
  8. require(__DIR__.'/skipif.inc');
  9. ?>
  10. --FILE--
  11. <?php
  12. require __DIR__."/connect.inc";
  13. $create_1 = "CREATE TABLE t1 (id INTEGER, l1 LONG)";
  14. $create_2 = "CREATE TABLE t2 (id INTEGER, l2 LONG)";
  15. $drop_1 = "DROP TABLE t1";
  16. $drop_2 = "DROP TABLE t2";
  17. $s1 = oci_parse($c, $drop_1);
  18. $s2 = oci_parse($c, $drop_2);
  19. @oci_execute($s1);
  20. @oci_execute($s2);
  21. $s1 = oci_parse($c, $create_1);
  22. $s2 = oci_parse($c, $create_2);
  23. oci_execute($s1);
  24. oci_execute($s2);
  25. $values = array("1234567890111111111", "122222222222222", "985456745674567654567654567654", "123456789", "987654321");
  26. $i = 0;
  27. foreach ($values as $val) {
  28. $i++;
  29. $insert = "INSERT INTO t1 VALUES($i, ".$val.")";
  30. $s = oci_parse($c, $insert);
  31. oci_execute($s);
  32. }
  33. foreach ($values as $val) {
  34. $insert = "INSERT INTO t2 VALUES($i, ".$val.")";
  35. $s = oci_parse($c, $insert);
  36. oci_execute($s);
  37. $i--;
  38. }
  39. $query ="
  40. SELECT
  41. t1.l1, t2.l2
  42. FROM
  43. t1, t2
  44. WHERE
  45. t1.id = t2.id
  46. ORDER BY t1.id ASC
  47. ";
  48. $sth = oci_parse($c, $query);
  49. oci_execute($sth);
  50. while ( $row = oci_fetch_assoc($sth) ) {
  51. var_dump($row);
  52. }
  53. $s1 = oci_parse($c, $drop_1);
  54. $s2 = oci_parse($c, $drop_2);
  55. @oci_execute($s1);
  56. @oci_execute($s2);
  57. echo "Done\n";
  58. ?>
  59. --EXPECT--
  60. array(2) {
  61. ["L1"]=>
  62. string(19) "1234567890111111111"
  63. ["L2"]=>
  64. string(9) "987654321"
  65. }
  66. array(2) {
  67. ["L1"]=>
  68. string(15) "122222222222222"
  69. ["L2"]=>
  70. string(9) "123456789"
  71. }
  72. array(2) {
  73. ["L1"]=>
  74. string(30) "985456745674567654567654567654"
  75. ["L2"]=>
  76. string(30) "985456745674567654567654567654"
  77. }
  78. array(2) {
  79. ["L1"]=>
  80. string(9) "123456789"
  81. ["L2"]=>
  82. string(15) "122222222222222"
  83. }
  84. array(2) {
  85. ["L1"]=>
  86. string(9) "987654321"
  87. ["L2"]=>
  88. string(19) "1234567890111111111"
  89. }
  90. Done