]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/WikiDB/adodb/tests/testoci8.php
Upgrade adodb
[SourceForge/phpwiki.git] / lib / WikiDB / adodb / tests / testoci8.php
1 <html>
2 <body>
3 <?php
4 /* 
5 V4.80 8 Mar 2006  (c) 2000-2012 John Lim (jlim#natsoft.com). All rights reserved.
6   Released under both BSD license and Lesser GPL library license. 
7   Whenever there is any discrepancy between the two licenses, 
8   the BSD license will take precedence. 
9   Set tabs to 4 for best viewing.
10         
11   Latest version is available at http://adodb.sourceforge.net
12 */
13 error_reporting(E_ALL | E_STRICT);
14 include("../adodb.inc.php");
15 include("../tohtml.inc.php");
16
17 if (0) {
18         $db = ADONewConnection('oci8po');
19         
20         $db->PConnect('','scott','natsoft');
21         if (!empty($testblob)) {
22                 $varHoldingBlob = 'ABC DEF GEF John TEST';
23                 $num = time()%10240;
24                 // create table atable (id integer, ablob blob);
25                 $db->Execute('insert into ATABLE (id,ablob) values('.$num.',empty_blob())');
26                 $db->UpdateBlob('ATABLE', 'ablob', $varHoldingBlob, 'id='.$num, 'BLOB');
27                 
28                 $rs = $db->Execute('select * from atable');
29                 
30                 if (!$rs) die("Empty RS");
31                 if ($rs->EOF) die("EOF RS");
32                 rs2html($rs);
33         }
34         $stmt = $db->Prepare('select * from adoxyz where id=?');
35         for ($i = 1; $i <= 10; $i++) {
36         $rs = $db->Execute(
37                 $stmt,
38                 array($i));
39                         
40                 if (!$rs) die("Empty RS");
41                 if ($rs->EOF) die("EOF RS");
42                 rs2html($rs);
43         }
44 }
45 if (1) {
46         $db = ADONewConnection('oci8');
47         $db->PConnect('','scott','natsoft');
48         $db->debug = true;
49         $db->Execute("delete from emp where ename='John'");
50         print $db->Affected_Rows().'<BR>';
51         $stmt = $db->Prepare('insert into emp (empno, ename) values (:empno, :ename)');
52         $rs = $db->Execute($stmt,array('empno'=>4321,'ename'=>'John'));
53         // prepare not quite ready for prime time
54         //$rs = $db->Execute($stmt,array('empno'=>3775,'ename'=>'John'));
55         if (!$rs) die("Empty RS");
56         
57         $db->setfetchmode(ADODB_FETCH_NUM);
58         
59         $vv = 'A%';
60         $stmt = $db->PrepareSP("BEGIN adodb.open_tab2(:rs,:tt); END;",true);
61         $db->OutParameter($stmt, $cur, 'rs', -1, OCI_B_CURSOR);
62         $db->OutParameter($stmt, $vv, 'tt');
63         $rs = $db->Execute($stmt);
64         while (!$rs->EOF) {
65                 adodb_pr($rs->fields);
66                 $rs->MoveNext();
67         }
68         echo " val = $vv";
69
70 }
71
72 if (0) {
73         $db = ADONewConnection('odbc_oracle');
74         if (!$db->PConnect('local_oracle','scott','tiger')) die('fail connect');
75         $db->debug = true;
76         $rs = $db->Execute(
77                 'select * from adoxyz where firstname=? and trim(lastname)=?',
78                 array('first'=>'Caroline','last'=>'Miranda'));
79         if (!$rs) die("Empty RS");
80         if ($rs->EOF) die("EOF RS");
81         rs2html($rs);
82 }
83 ?>