drcp_scope1.phpt 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. --TEST--
  2. DRCP: oci_new_connect() and oci_connect() with scope end when oci8.old_oci_close_semantics ON
  3. --EXTENSIONS--
  4. oci8
  5. --INI--
  6. oci8.old_oci_close_semantics=1
  7. --FILE--
  8. <?php
  9. require __DIR__."/drcp_functions.inc";
  10. require __DIR__."/details.inc";
  11. // Scope considered here is the functional scope
  12. // Test will open a connection within a function (function 1).
  13. // Update a table
  14. // Open another connection from function 2.
  15. // When the scope ends the txn is rolled back and hence the updated value
  16. // will not be reflected for oci_connect and oci_new_connect.
  17. // Create the table
  18. $c = oci_new_connect($user,$password,$dbase);
  19. @drcp_drop_table($c);
  20. drcp_create_table($c);
  21. // OCI_NEW_CONNECT
  22. $conn_type = 1;
  23. echo "This is with a OCI_NEW_CONNECT\n";
  24. function1($user,$password,$dbase,$conn_type);
  25. // Should return the OLD value
  26. function2($user,$password,$dbase,$conn_type);
  27. // OCI_CONNECT
  28. $conn_type = 2;
  29. echo "\n\nThis is with a OCI_CONNECT\n";
  30. function1($user,$password,$dbase,$conn_type);
  31. // Should return the OLD value
  32. function2($user,$password,$dbase,$conn_type);
  33. //This is the first scope for the script
  34. function function1($user,$password,$dbase,$conn_type)
  35. {
  36. switch($conn_type)
  37. {
  38. case 1:
  39. var_dump($conn1 = oci_new_connect($user,$password,$dbase));
  40. break;
  41. case 2:
  42. var_dump($conn1 = oci_connect($user,$password,$dbase));
  43. break;
  44. }
  45. drcp_update_table($conn1);
  46. }
  47. // This is the second scope
  48. function function2($user,$password,$dbase,$conn_type)
  49. {
  50. switch($conn_type)
  51. {
  52. case 1:
  53. var_dump($conn1 = oci_new_connect($user,$password,$dbase));
  54. break;
  55. case 2:
  56. var_dump($conn1 = oci_connect($user,$password,$dbase));
  57. break;
  58. }
  59. drcp_select_value($conn1);
  60. }
  61. drcp_drop_table($c);
  62. oci_close($c);
  63. echo "Done\n";
  64. ?>
  65. --EXPECTF--
  66. Deprecated: Directive oci8.old_oci_close_semantics is deprecated%s
  67. This is with a OCI_NEW_CONNECT
  68. resource(%d) of type (oci8 connection)
  69. Update done-- DEPT value has been set to NEWDEPT
  70. resource(%d) of type (oci8 connection)
  71. The value of DEPT for id 105 is HR
  72. This is with a OCI_CONNECT
  73. resource(%d) of type (oci8 connection)
  74. Update done-- DEPT value has been set to NEWDEPT
  75. resource(%d) of type (oci8 connection)
  76. The value of DEPT for id 105 is HR
  77. Done