Back to index

php5  5.3.10
details.inc
Go to the documentation of this file.
00001 <?php
00002 
00003 /*
00004  * Please change $user, $password and $dbase to match your configuration.
00005  *
00006  * Set $test_drcp to TRUE if you want to run the Oracle Database
00007  * Resident Connection Pooling (DRCP) tests. For these tests to run
00008  * successfully, you need a server and client which is Oracle 11g or
00009  * greater, and $dbase should be set to the tnsnames.ora entry
00010  * corresponding to the POOLED server instance or an Easy Connect
00011  * string like hostname:port/service_name:POOLED
00012  */
00013 
00014 if (file_exists(dirname(__FILE__)."/details_local.inc")) {
00015        include(dirname(__FILE__)."/details_local.inc");   // this file is not part of the source distribution; make it your own local variant of details.inc
00016 } else {
00017        if (false !== getenv('PHP_OCI8_TEST_DB')) {
00018               $user         = getenv('PHP_OCI8_TEST_USER');      // Database username for tests
00019               $password     = getenv('PHP_OCI8_TEST_PASS');      // Password for $user
00020               $dbase        = getenv('PHP_OCI8_TEST_DB');        // Database connection string
00021               $test_drcp    = getenv('PHP_OCI8_TEST_DRCP');
00022               if (false !== $test_drcp && 0 == strcasecmp($test_drcp,'TRUE')) {
00023                      $test_drcp = TRUE;
00024               } else {
00025                      $test_drcp = FALSE;
00026               }
00027        } else {
00028               $user                                     = "system";
00029               $password                                 = "oracle";
00030               $dbase                                    = "localhost/XE";
00031               $test_drcp                                = FALSE;
00032        }
00033        
00034        /*
00035         * Common object names for scripts to use
00036         */
00037        
00038        $table_name = "tb".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5);
00039        $type_name = strtoupper("tp".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5));
00040        $schema = '';
00041 }
00042 
00043 
00044 /*
00045  * Used for creating/dropping schema objects used by a test
00046  */
00047 
00048 function oci8_test_sql_execute($c, $stmtarray)
00049 {
00050        foreach ($stmtarray as $stmt) {
00051               $s = oci_parse($c, $stmt);
00052               if (!$s) {
00053                      $m = oci_error($c);
00054                      echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
00055               }
00056               else {
00057                      $r = @oci_execute($s);
00058                      if (!$r) {
00059                             $m = oci_error($s);
00060                             if (!in_array($m['code'], array(   // ignore expected errors
00061                                                         942 // table or view does not exist
00062                                                  ,  1918 // user does not exist
00063                                                  ,  2024 // database link not found
00064                                                  ,  2289 // sequence does not exist
00065                                                  ,  4080 // trigger does not exist
00066                                                  , 38802 // edition does not exist
00067                                           ))) {
00068                                    echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
00069                             }
00070                      }
00071               }
00072        }
00073 }
00074 
00075 ?>