details.inc 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. /*
  3. * Please change $user, $password and $dbase to match your configuration.
  4. *
  5. * Set $test_drcp to TRUE if you want to run the Oracle Database
  6. * Resident Connection Pooling (DRCP) tests. For these tests to run
  7. * successfully, you need a server and client which is Oracle 11g or
  8. * greater, and $dbase should be set to the tnsnames.ora entry
  9. * corresponding to the POOLED server instance or an Easy Connect
  10. * string like hostname:port/service_name:POOLED
  11. */
  12. if (file_exists(dirname(__FILE__)."/details_local.inc")) {
  13. include(dirname(__FILE__)."/details_local.inc"); // this file is not part of the source distribution; make it your own local variant of details.inc
  14. } else {
  15. if (false !== getenv('PHP_OCI8_TEST_DB')) {
  16. $user = getenv('PHP_OCI8_TEST_USER'); // Database username for tests
  17. $password = getenv('PHP_OCI8_TEST_PASS'); // Password for $user
  18. $dbase = getenv('PHP_OCI8_TEST_DB'); // Database connection string
  19. $test_drcp = getenv('PHP_OCI8_TEST_DRCP');
  20. if (false !== $test_drcp && 0 == strcasecmp($test_drcp,'TRUE')) {
  21. $test_drcp = TRUE;
  22. } else {
  23. $test_drcp = FALSE;
  24. }
  25. } else {
  26. $user = "system";
  27. $password = "oracle";
  28. $dbase = "localhost/XE";
  29. $test_drcp = FALSE;
  30. }
  31. /*
  32. * Common object names for scripts to use
  33. */
  34. $table_name = "tb".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5);
  35. $type_name = strtoupper("tp".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5));
  36. $schema = '';
  37. }
  38. /*
  39. * Used for creating/dropping schema objects used by a test
  40. */
  41. if (!function_exists('oci8_test_sql_execute')) {
  42. function oci8_test_sql_execute($c, $stmtarray)
  43. {
  44. foreach ($stmtarray as $stmt) {
  45. $s = oci_parse($c, $stmt);
  46. if (!$s) {
  47. $m = oci_error($c);
  48. echo "oci8_test_sql_execute() error:". PHP_EOL . $stmt . PHP_EOL . $m['message'] . PHP_EOL;
  49. }
  50. else {
  51. $r = @oci_execute($s);
  52. if (!$r) {
  53. $m = oci_error($s);
  54. if (!in_array($m['code'], array( // ignore expected errors
  55. 942 // table or view does not exist
  56. , 1918 // user does not exist
  57. , 2024 // database link not found
  58. , 2289 // sequence does not exist
  59. , 4080 // trigger does not exist
  60. , 38802 // edition does not exist
  61. ))) {
  62. echo "oci8_test_sql_execute() error:". PHP_EOL . $stmt . PHP_EOL . $m['message'] . PHP_EOL;
  63. }
  64. }
  65. }
  66. }
  67. }
  68. }
  69. ?>