Annotation of embedaddon/php/ext/oci8/tests/edition_2.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Set and check Oracle 11gR2 "edition" attribute
        !             3: --SKIPIF--
        !             4: <?php
        !             5: if (!extension_loaded('oci8')) die("skip no oci8 extension"); 
        !             6: require(dirname(__FILE__)."/connect.inc");
        !             7: if (strcasecmp($user, "system") && strcasecmp($user, "sys"))
        !             8:     die("skip needs to be run as a DBA user");
        !             9: if ($test_drcp)
        !            10:     die("skip as Output might vary with DRCP");
        !            11: 
        !            12: if (preg_match('/Release (1[1]\.2|12)\./', oci_server_version($c), $matches) !== 1) {
        !            13:        die("skip expected output only valid when using Oracle 11gR2 or greater databases");
        !            14: } else if (preg_match('/^(11\.2|12)\./', oci_client_version()) != 1) {
        !            15:     die("skip test expected to work only with Oracle 11gR2 or greater version of client");
        !            16: }
        !            17: 
        !            18: ?>
        !            19: --FILE--
        !            20: <?php
        !            21: 
        !            22: /* In 11.2, there can only be one child edition.  So this test will
        !            23:  * fail to create the necessary editions if a child edition exists
        !            24:  * already
        !            25:  */
        !            26: 
        !            27: require(dirname(__FILE__)."/conn_attr.inc");
        !            28: 
        !            29: $user = 'testuser';
        !            30: $password = 'testuser';
        !            31: 
        !            32: echo"**Test 1.1 - Default value for  the attribute **************\n";
        !            33: get_edit_attr($c);
        !            34: 
        !            35: echo"\n\n**Test 1.2 - Set a value and get the same with different connections *********\n";
        !            36: set_edit_attr('MYEDITION');
        !            37: 
        !            38: // With oci_connect, oci_pconnect, oci_new_connect
        !            39: $conn1 = get_conn(1);
        !            40: get_edit_attr($conn1);
        !            41: 
        !            42: //pconnect
        !            43: $conn2 = get_conn(2);
        !            44: get_edit_attr($conn2);
        !            45: 
        !            46: //new_connect
        !            47: $conn3 = get_conn(3);
        !            48: get_edit_attr($conn3);
        !            49: 
        !            50: oci_close($conn1);
        !            51: 
        !            52: // With a oci_pconnect with a different charset.
        !            53: $pc1 = oci_pconnect($user,$password,$dbase,"utf8");
        !            54: get_edit_attr($pc1);
        !            55: oci_close($pc1);
        !            56: 
        !            57: 
        !            58: echo"\n\n**Test 1.3 change the value and verify with existing conenctions.*********\n";
        !            59: set_edit_attr('MYEDITION1');
        !            60: get_edit_attr($conn2);
        !            61: get_edit_attr($conn3); // Old value
        !            62: oci_close($conn2);
        !            63: oci_close($conn3);
        !            64: 
        !            65: //open a new connection and get the edition value . This will have the updated value.
        !            66: $c3 = get_conn(3); //oci_new_connect()
        !            67: get_edit_attr($c3);
        !            68: 
        !            69: $c4 = get_conn(2); //oci_pconnect()
        !            70: get_edit_attr($c4);
        !            71: 
        !            72: $c5 = get_conn(1); //oci_connect()
        !            73: get_edit_attr($c5);
        !            74: 
        !            75: oci_close($c3);
        !            76: oci_close($c4);
        !            77: oci_close($c5);
        !            78: 
        !            79: echo "\n\n**Test 1.4 - with different type of values *********\n";
        !            80: $values_array = array(123,NULL,'NO EDITION','edition name which has more than thirty chars!!!edition name which has more than thirty chars!!!');
        !            81: foreach ($values_array as $val ) {
        !            82:        set_edit_attr($val);
        !            83:        $c1 = get_conn(1); //oci_connect()
        !            84:        if ($c1) {
        !            85:                get_edit_attr($c1);
        !            86:                oci_close($c1);
        !            87:        }       
        !            88: }
        !            89: 
        !            90: echo "\n\n**Test 1.5 - Negative case with an invalid string value. *********\n";
        !            91: $c1 = get_conn(3);
        !            92: $r = set_edit_attr($c1);
        !            93: 
        !            94: echo"\n\n**Test 1.6 - Set Multiple times.*****\n";
        !            95: set_edit_attr('MYEDITION');
        !            96: set_edit_attr('MYEDITION1');
        !            97: $c1 = get_conn(1);
        !            98: get_edit_attr($c1);
        !            99: oci_close($c1);
        !           100: 
        !           101: echo "\n\n**Test 1.7 - Test with ALTER SESSION statement to change the edition *******\n";
        !           102: // Set the edition value to MYEDITION. open a conn .get the value.
        !           103: // execute the alter system set edition ='MYEDITION' .get the value .
        !           104: // set it back to MYEDITION using oci_set_edition. and get the value.
        !           105: 
        !           106: set_edit_attr('MYEDITION');
        !           107: $c1 = get_conn(3);
        !           108: echo "get the value set to MYEDITION with oci_set_edition \n";
        !           109: get_edit_attr($c1);
        !           110: 
        !           111: $alter_stmt = "alter session set edition = MYEDITION1";
        !           112: $s = oci_parse($c1,$alter_stmt);
        !           113: oci_execute($s);
        !           114: oci_commit($c1);
        !           115: echo "Get the value set to MYEDITION1 with alter session\n";
        !           116: get_edit_attr($c1);
        !           117: 
        !           118: echo " Get the value with a new connection \n";
        !           119: $c2 = get_conn(1);
        !           120: get_edit_attr($c2);
        !           121: 
        !           122: echo " Set the value back using oci-set_edition\n";
        !           123: set_edit_attr('MYEDITION');
        !           124: get_edit_attr($c2);
        !           125: 
        !           126: echo " Get the value with a new conenction \n";
        !           127: $c3 = get_conn(1);
        !           128: get_edit_attr($c3);
        !           129: 
        !           130: oci_close($c1);
        !           131: oci_close($c2);
        !           132: oci_close($c3);
        !           133: 
        !           134: 
        !           135: echo "\n\n**Test 1.8 - Test setting the attribute with scope ends*******\n";
        !           136: set_scope();
        !           137: get_scope();
        !           138: 
        !           139: clean_up($c);
        !           140: echo "Done\n";
        !           141: 
        !           142: 
        !           143: function set_scope() {
        !           144:        $r = set_edit_attr('MYEDITION1');
        !           145: }
        !           146: 
        !           147: function get_scope() {
        !           148:     $sc1 = oci_connect($GLOBALS['user'],$GLOBALS['password'],$GLOBALS['dbase']);
        !           149:     if ($sc1 === false) {
        !           150:         $m = oci_error();
        !           151:         die("Error:" . $m['message']);
        !           152:     }
        !           153:        get_edit_attr($sc1);
        !           154:        oci_close($sc1);
        !           155: }
        !           156: ?>
        !           157: --EXPECTF--
        !           158: **Test 1.1 - Default value for  the attribute **************
        !           159: The value of current EDITION is ORA$BASE
        !           160: 
        !           161: 
        !           162: **Test 1.2 - Set a value and get the same with different connections *********
        !           163:  The value of edition has been successfully set
        !           164: Testing with oci_connect()
        !           165: The value of current EDITION is MYEDITION
        !           166: Testing with oci_pconnect()
        !           167: The value of current EDITION is MYEDITION
        !           168: Testing with oci_new_connect()
        !           169: The value of current EDITION is MYEDITION
        !           170: The value of current EDITION is MYEDITION
        !           171: 
        !           172: 
        !           173: **Test 1.3 change the value and verify with existing conenctions.*********
        !           174:  The value of edition has been successfully set
        !           175: The value of current EDITION is MYEDITION
        !           176: The value of current EDITION is MYEDITION
        !           177: Testing with oci_new_connect()
        !           178: The value of current EDITION is MYEDITION1
        !           179: Testing with oci_pconnect()
        !           180: The value of current EDITION is MYEDITION1
        !           181: Testing with oci_connect()
        !           182: The value of current EDITION is MYEDITION1
        !           183: 
        !           184: 
        !           185: **Test 1.4 - with different type of values *********
        !           186:  The value of edition has been successfully set
        !           187: Testing with oci_connect()
        !           188: 
        !           189: Warning: oci_connect(): ORA-38801: %s ORA_EDITION in %s on line %d
        !           190:  The value of edition has been successfully set
        !           191: Testing with oci_connect()
        !           192: The value of current EDITION is ORA$BASE
        !           193:  The value of edition has been successfully set
        !           194: Testing with oci_connect()
        !           195: 
        !           196: Warning: oci_connect(): ORA-38801: %s ORA_EDITION in %s on line %d
        !           197:  The value of edition has been successfully set
        !           198: Testing with oci_connect()
        !           199: 
        !           200: Warning: oci_connect(): ORA-38801: %s ORA_EDITION in %s on line %d
        !           201: 
        !           202: 
        !           203: **Test 1.5 - Negative case with an invalid string value. *********
        !           204: Testing with oci_new_connect()
        !           205: 
        !           206: Warning: oci_new_connect(): ORA-38801: %s ORA_EDITION in %s on line %d
        !           207:  The value of edition has been successfully set
        !           208: 
        !           209: 
        !           210: **Test 1.6 - Set Multiple times.*****
        !           211:  The value of edition has been successfully set
        !           212:  The value of edition has been successfully set
        !           213: Testing with oci_connect()
        !           214: The value of current EDITION is MYEDITION1
        !           215: 
        !           216: 
        !           217: **Test 1.7 - Test with ALTER SESSION statement to change the edition *******
        !           218:  The value of edition has been successfully set
        !           219: Testing with oci_new_connect()
        !           220: get the value set to MYEDITION with oci_set_edition 
        !           221: The value of current EDITION is MYEDITION
        !           222: Get the value set to MYEDITION1 with alter session
        !           223: The value of current EDITION is MYEDITION1
        !           224:  Get the value with a new connection 
        !           225: Testing with oci_connect()
        !           226: The value of current EDITION is MYEDITION
        !           227:  Set the value back using oci-set_edition
        !           228:  The value of edition has been successfully set
        !           229: The value of current EDITION is MYEDITION
        !           230:  Get the value with a new conenction 
        !           231: Testing with oci_connect()
        !           232: The value of current EDITION is MYEDITION
        !           233: 
        !           234: 
        !           235: **Test 1.8 - Test setting the attribute with scope ends*******
        !           236:  The value of edition has been successfully set
        !           237: The value of current EDITION is MYEDITION1
        !           238: Done
        !           239: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>