From 6014731ea95069ca2ff910793bfb996ae0a5ce30 Mon Sep 17 00:00:00 2001 From: Stefan Livieratos Date: Sat, 8 Jul 2000 11:19:40 +0000 Subject: [PATCH] Small corrections and cosmetic changes git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@27865 c90b9560-bf6c-de11-be94-00142212c4b1 --- functions/network.xml | 2 +- functions/oci8.xml | 129 ++++++++++++++++++++++++------------------ 2 files changed, 76 insertions(+), 55 deletions(-) diff --git a/functions/network.xml b/functions/network.xml index 2cf6c596da..1217cd9bcd 100644 --- a/functions/network.xml +++ b/functions/network.xml @@ -173,7 +173,7 @@ <function>Fsockopen</function> Example -$fp = fsockopen ("www.php.net", 80, &$errno, &$errstr, 30); +$fp = fsockopen ("www.php.net", 80, &$errno, &$errstr, 30); if (!$fp) { echo "$errstr ($errno)<br>\n"; } else { diff --git a/functions/oci8.xml b/functions/oci8.xml index 759751835a..c4ec7b8bfd 100644 --- a/functions/oci8.xml +++ b/functions/oci8.xml @@ -60,7 +60,7 @@ OCIFreeCursor int OCIDefineByName int stmt string Column-Name - mixed &variable + mixed &variable int type @@ -91,8 +91,8 @@ $stmt = OCIParse($conn,"select empno, ename from emp"); /* the define MUST be done BEFORE ociexecute! */ -OCIDefineByName($stmt,"EMPNO",&$empno); -OCIDefineByName($stmt,"ENAME",&$ename); +OCIDefineByName($stmt,"EMPNO",&$empno); +OCIDefineByName($stmt,"ENAME",&$ename); OCIExecute($stmt); @@ -103,8 +103,9 @@ while (OCIFetch($stmt)) { OCIFreeStatement($stmt); OCILogoff($conn); -?> - +?> + + @@ -120,7 +121,7 @@ OCILogoff($conn); int OCIBindByName int stmt string ph_name - mixed &variable + mixed &variable intlength int type @@ -147,9 +148,9 @@ OCILogoff($conn); (Character-File), OCI_B_CLOB (Character-LOB), OCI_B_BLOB (Binary-LOB) and OCI_B_ROWID (ROWID). - - OCIDefineByName - + + OCIDefineByName + <?php /* OCIBindByPos example thies@digicol.de (980221) @@ -167,13 +168,13 @@ $data = array(1111 => "Larry", 2222 => "Bill", 3333 => "Jim"); $rowid = OCINewDescriptor($conn,OCI_D_ROWID); -OCIBindByName($stmt,":empno",&$empno,32); -OCIBindByName($stmt,":ename",&$ename,32); -OCIBindByName($stmt,":rid",&$rowid,-1,OCI_B_ROWID); +OCIBindByName($stmt,":empno",&$empno,32); +OCIBindByName($stmt,":ename",&$ename,32); +OCIBindByName($stmt,":rid",&$rowid,-1,OCI_B_ROWID); $update = OCIParse($conn,"update emp set sal = :sal where ROWID = :rid"); -OCIBindByName($update,":rid",&$rowid,-1,OCI_B_ROWID); -OCIBindByName($update,":sal",&$sal,32); +OCIBindByName($update,":rid",&$rowid,-1,OCI_B_ROWID); +OCIBindByName($update,":sal",&$sal,32); $sal = 10000; @@ -189,7 +190,7 @@ OCIFreeStatement($stmt); $stmt = OCIParse($conn,"select * from emp where empno in (1111,2222,3333)"); OCIExecute($stmt); -while (OCIFetchInto($stmt,&$arr,OCI_ASSOC)) { +while (OCIFetchInto($stmt,&$arr,OCI_ASSOC)) { var_dump($arr); } OCIFreeStatement($stmt); @@ -200,10 +201,12 @@ OCIExecute($stmt); OCIFreeStatement($stmt); OCILogoff($conn); -?> +?> + + - + OCILogon @@ -575,15 +578,16 @@ print "</PRE></HTML>"; - OCINewDescriptor Allocates storage to hold descriptors or LOB locators. - Valid values for the valid type are OCI_D_FILE, OCI_D_LOB, OCI_D_ROWID. - For LOB desriptors, the methods load, save, and savefile are associated with the descriptor, - for BFILE only the load method exists. See the second example usage hints. - + OCINewDescriptor Allocates storage to hold + descriptors or LOB locators. Valid values for the valid + type are OCI_D_FILE, OCI_D_LOB, OCI_D_ROWID. + For LOB desriptors, the methods load, save, and savefile are + associated with the descriptor, for BFILE only the load method exists. + See the second example usage hints. - - OCINewDescriptor - + + OCINewDescriptor + <?php /* This script is designed to be called from a HTML form. * It expects $user, $password, $table, $where, and $commitsize @@ -594,12 +598,12 @@ print "</PRE></HTML>"; $conn = OCILogon($user, $password); $stmt = OCIParse($conn,"select rowid from $table $where"); $rowid = OCINewDescriptor($conn,OCI_D_ROWID); - OCIDefineByName($stmt,"ROWID",&$rowid); + OCIDefineByName($stmt,"ROWID",&$rowid); OCIExecute($stmt); while ( OCIFetch($stmt) ) { $nrows = OCIRowCount($stmt); $delete = OCIParse($conn,"delete from $table where ROWID = :rid"); - OCIBindByName($delete,":rid",&$rowid,-1,OCI_B_ROWID); + OCIBindByName($delete,":rid",&$rowid,-1,OCI_B_ROWID); OCIExecute($delete); print "$nrows\n"; if ( ($nrows % $commitsize) == 0 ) { @@ -611,7 +615,8 @@ print "</PRE></HTML>"; OCIFreeStatement($stmt); OCILogoff($conn); ?> - + + <?php /* This script demonstrates file upload to LOB columns * The formfield used for this example looks like this @@ -631,7 +636,7 @@ Upload file: <input type="file" name="lob_upload"><br> $conn = OCILogon($user, $password); $lob = OCINewDescriptor($conn, OCI_D_LOB); $stmt = OCIParse($conn,"insert into $table (id, the_blob) values(my_seq.NEXTVAL, EMPTY_BLOB()) returning the_blob into :the_blob"); - OCIBindByName($stmt, ':the_blob', &$lob, -1, OCI_B_BLOB); + OCIBindByName($stmt, ':the_blob', &$lob, -1, OCI_B_BLOB); OCIExecute($stmt); if($lob->savefile($lob_upload)){ OCICommit($conn); @@ -644,8 +649,8 @@ Upload file: <input type="file" name="lob_upload"><br> OCILogoff($conn); } ?> - - + + @@ -705,10 +710,12 @@ Upload file: <input type="file" name="lob_upload"><br> - OCINumCols returns the number of columns in a statement - - OCINumCols - + OCINumCols returns the number of columns in a + statement + + + OCINumCols + <?php print "<HTML><PRE>\n"; $conn = OCILogon("scott", "tiger"); @@ -717,7 +724,7 @@ Upload file: <input type="file" name="lob_upload"><br> while ( OCIFetch($stmt) ) { print "\n"; $ncols = OCINumCols($stmt); - for ( $i = 1; $i <= $ncols; $i++ ) { + for ( $i = 1; $i <= $ncols; $i++ ) { $column_name = OCIColumnName($stmt,$i); $column_value = OCIResult($stmt,$i); print $column_name . ': ' . $column_value . "\n"; @@ -728,8 +735,9 @@ Upload file: <input type="file" name="lob_upload"><br> OCILogoff($conn); print "</PRE>"; print "</HTML>\n"; -?> - +?> + + @@ -787,7 +795,7 @@ Upload file: <input type="file" name="lob_upload"><br> int OCIFetchInto int stmt - array &result + array &result int mode @@ -828,7 +836,7 @@ Upload file: <input type="file" name="lob_upload"><br> int OCIFetchStatement int stmt - array &variable + array &variable @@ -940,7 +948,7 @@ OCILogoff($conn); print "<TH>Length</TH>"; print "</TR>"; $ncols = OCINumCols($stmt); - for ( $i = 1; $i <= $ncols; $i++ ) { + for ( $i = 1; $i <= $ncols; $i++ ) { $column_name = OCIColumnName($stmt,$i); $column_type = OCIColumnType($stmt,$i); $column_size = OCIColumnSize($stmt,$i); @@ -955,7 +963,10 @@ OCILogoff($conn); OCILogoff($conn); print "</PRE>"; print "</HTML>\n"; -?> +?> + + + See also OCINumCols, OCIColumnName, and OCIColumnSize. @@ -1065,19 +1076,21 @@ $conn = OCILogon("scott","tiger"); $curs = OCINewCursor($conn); $stmt = OCIParse($conn,"begin info.output(:data); end;"); -ocibindbyname($stmt,"data",&$curs,-1,OCI_B_CURSOR); +ocibindbyname($stmt,"data",&$curs,-1,OCI_B_CURSOR); ociexecute($stmt); ociexecute($curs); -while (OCIFetchInto($curs,&$data)) { +while (OCIFetchInto($curs,&$data)) { var_dump($data); } OCIFreeCursor($stmt); OCIFreeStatement($curs); OCILogoff($conn); -?> - +?> + + + Using a REF CURSOR in a select statement @@ -1097,14 +1110,14 @@ print "<TH>DEPT #</TH>"; print "<TH># EMPLOYEES</TH>"; print "</TR>"; -while (OCIFetchInto($stmt,&$data,OCI_ASSOC)) { +while (OCIFetchInto($stmt,&$data,OCI_ASSOC)) { print "<TR>"; $dname = $data["DNAME"]; $deptno = $data["DEPTNO"]; print "<TD>$dname</TD>"; print "<TD>$deptno</TD>"; ociexecute($data[ "EMPCNT" ]); - while (OCIFetchInto($data[ "EMPCNT" ],&$subdata,OCI_ASSOC)) { + while (OCIFetchInto($data[ "EMPCNT" ],&$subdata,OCI_ASSOC)) { $num_emps = $subdata["NUM_EMPS"]; print "<TD>$num_emps</TD>"; } @@ -1114,8 +1127,10 @@ print "</TABLE>"; print "</BODY></HTML>"; OCIFreeStatement($stmt); OCILogoff($conn); -?> - +?> + + + @@ -1193,7 +1208,7 @@ OCILogoff($conn); print "<TH>Length</TH>"; print "</TR>"; $ncols = OCINumCols($stmt); - for ( $i = 1; $i <= $ncols; $i++ ) { + for ( $i = 1; $i <= $ncols; $i++ ) { $column_name = OCIColumnName($stmt,$i); $column_type = OCIColumnType($stmt,$i); $column_size = OCIColumnSize($stmt,$i); @@ -1207,7 +1222,10 @@ OCILogoff($conn); OCILogoff($conn); print "</PRE>"; print "</HTML>\n"; -?> +?> + + + See also OCINumCols, OCIColumnType, and OCIColumnSize. @@ -1248,7 +1266,7 @@ OCILogoff($conn); print "<TH>Length</TH>"; print "</TR>"; $ncols = OCINumCols($stmt); - for ( $i = 1; $i <= $ncols; $i++ ) { + for ( $i = 1; $i <= $ncols; $i++ ) { $column_name = OCIColumnName($stmt,$i); $column_type = OCIColumnType($stmt,$i); $column_size = OCIColumnSize($stmt,$i); @@ -1262,7 +1280,10 @@ OCILogoff($conn); OCILogoff($conn); print "</PRE>"; print "</HTML>\n"; -?> +?> + + + See also OCINumCols, OCIColumnName, and OCIColumnSize.