2
Basic test for setting Oracle 11gR2 "edition" attribute
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");
10
die("skip as Output might vary with DRCP");
12
$sv = oci_server_version($c);
13
$sv = preg_match('/Release (11\.2|12)/', $sv, $matches);
16
phpinfo(INFO_MODULES);
17
$phpinfo = ob_get_clean();
18
$iv = preg_match('/Oracle .*Version => (11\.2|12)/', $phpinfo);
20
die ("skip tests a feature that works only with Oracle 11gR2 or greater version of client");
24
die ("skip tests a feature that works only with Oracle 11gR2 or greater version of server");
31
/* In 11.2, there can only be one child edition. So this test will
32
* fail to create the necessary editions if a child edition exists
36
require(dirname(__FILE__)."/conn_attr.inc");
38
function select_fn($conn) {
39
$s = oci_parse($conn,"select * from view_ed");
41
while ($row = oci_fetch_row($s)) {
45
/* Create a editon MYEDITION
46
create a view view_ed in MYEDITION1.
47
create the same view 'view_ed' with a different definition in MYEDITION.
48
select from both the editions and verify the contents. */
50
set_edit_attr('MYEDITION');
51
$conn = oci_connect('testuser','testuser',$dbase);
52
if ($conn === false) {
54
die("Error:" . $m['message']);
58
"drop table edit_tab",
59
"create table edit_tab (name varchar2(10),age number,job varchar2(50), salary number)",
60
"insert into edit_tab values('mike',30,'Senior engineer',200)",
61
"insert into edit_tab values('juan',25,'engineer',100)",
62
"create or replace editioning view view_ed as select name,age,job from edit_tab",
65
foreach ($stmtarray as $stmt) {
66
$s = oci_parse($conn, $stmt);
70
// Check the current edition of the DB and the contents of view_ed.
74
// Create a different version of view_ed in MYEDITION1.
75
set_edit_attr('MYEDITION1');
76
$conn2 = oci_new_connect('testuser','testuser',$dbase);
77
$stmt = "create or replace editioning view view_ed as select name,age,job,salary from edit_tab";
78
$s = oci_parse($conn2, $stmt);
81
// Check the current edition of the DB and the contents of view_ed.
82
get_edit_attr($conn2);
85
// Verify the contents in MYEDITION EDITION.
86
echo "version of view_ed in MYEDITION \n";
98
The value of edition has been successfully set
99
The value of current EDITION is MYEDITION
102
%unicode|string%(%d) "mike"
104
%unicode|string%(%d) "30"
106
%unicode|string%(%d) "Senior engineer"
110
%unicode|string%(%d) "juan"
112
%unicode|string%(%d) "25"
114
%unicode|string%(%d) "engineer"
116
The value of edition has been successfully set
117
The value of current EDITION is MYEDITION1
120
%unicode|string%(%d) "mike"
122
%unicode|string%(%d) "30"
124
%unicode|string%(%d) "Senior engineer"
126
%unicode|string%(%d) "200"
130
%unicode|string%(%d) "juan"
132
%unicode|string%(%d) "25"
134
%unicode|string%(%d) "engineer"
136
%unicode|string%(%d) "100"
138
version of view_ed in MYEDITION
139
The value of current EDITION is MYEDITION
142
%unicode|string%(%d) "mike"
144
%unicode|string%(%d) "30"
146
%unicode|string%(%d) "Senior engineer"
150
%unicode|string%(%d) "juan"
152
%unicode|string%(%d) "25"
154
%unicode|string%(%d) "engineer"