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

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

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