00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058 include('../adodb.inc.php');
00059 include('../tohtml.inc.php');
00060
00061 error_reporting(E_ALL);
00062 $db = ADONewConnection('oci8');
00063 $db->PConnect('','scott','natsoft');
00064 $db->debug = 99;
00065
00066
00067
00068
00069
00070 define('MYNUM',5);
00071
00072
00073 $rs = $db->ExecuteCursor("BEGIN adodb.open_tab(:RS,'A%'); END;");
00074
00075 if ($rs && !$rs->EOF) {
00076 print "Test 1 RowCount: ".$rs->RecordCount()."<p>";
00077 } else {
00078 print "<b>Error in using Cursor Variables 1</b><p>";
00079 }
00080
00081 print "<h4>Testing Stored Procedures for oci8</h4>";
00082
00083 $stid = $db->PrepareSP('BEGIN adodb.myproc('.MYNUM.', :myov); END;');
00084 $db->OutParameter($stid, $myov, 'myov');
00085 $db->Execute($stid);
00086 if ($myov != MYNUM) print "<p><b>Error with myproc</b></p>";
00087
00088
00089 $stmt = $db->PrepareSP("BEGIN adodb.data_out(:a1, :a2); END;",true);
00090 $a1 = 'Malaysia';
00091
00092 $db->InParameter($stmt,$a1,'a1');
00093 $db->OutParameter($stmt,$a2,'a2');
00094 $rs = $db->Execute($stmt);
00095 if ($rs) {
00096 if ($a2 !== 'Cinta Hati Malaysia') print "<b>Stored Procedure Error: a2 = $a2</b><p>";
00097 else echo "OK: a2=$a2<p>";
00098 } else {
00099 print "<b>Error in using Stored Procedure IN/Out Variables</b><p>";
00100 }
00101
00102
00103 $tname = 'A%';
00104
00105 $stmt = $db->PrepareSP('select * from tab where tname like :tablename');
00106 $db->Parameter($stmt,$tname,'tablename');
00107 $rs = $db->Execute($stmt);
00108 rs2html($rs);
00109
00110
00111 ?>