★ wanayoo — archive 1999 http://fr.php.net/manual/de/function.ocinewdescriptor.phpNouvelle recherche | Portail wanayoo
PHP Tuesday, March 20, 2001  
downloads | documentation | faq | support | reporting bugs | links 

search for in the  

lookup:
PHP HandbuchPHP Handbuch
OCI8OCI8
 OCIDefineByNameOCIDefineByName
 OCIBindByNameOCIBindByName
 OCILogonOCILogon
 OCIPLogonOCIPLogon
 OCINLogonOCINLogon
 OCILogOffOCILogOff
 OCIExecuteOCIExecute
 OCICommitOCICommit
 OCIRollbackOCIRollback
 OCINewDescriptorOCINewDescriptor
 OCIRowCountOCIRowCount
 OCINumColsOCINumCols
 OCIResultOCIResult
 OCIFetchOCIFetch
 OCIFetchIntoOCIFetchInto
 OCIFetchStatementOCIFetchStatement
 OCIColumnIsNULLOCIColumnIsNULL
 OCIColumnSizeOCIColumnSize
 OCIServerVersionOCIServerVersion
 OCIStatementTypeOCIStatementType
 OCINewCursorOCINewCursor
 OCIFreeStatementOCIFreeStatement
 OCIFreeCursorOCIFreeCursor
 OCIColumnNameOCIColumnName
 OCIColumnTypeOCIColumnType
 OCIParseOCIParse
 OCIErrorOCIError
 OCIInternalDebugOCIInternalDebug

previousOCIRollback
OCIRowCountnext

Last updated: Tue, 20 Mar 2001
view this page in English | Brazilian Portuguese | Czech | Dutch | French | German | Hungarian | Italian | Japanese | Korean | Spanish | Plain HTML

OCINewDescriptor

(PHP 3>= 3.0.7, PHP 4 )

OCINewDescriptor -- Initialize a new empty descriptor LOB/FILE (LOB is default)

Beschreibung

string OCINewDescriptor (int connection [, int type])

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.

Beispiel 1. OCINewDescriptor


<?php   
    /* This script is designed to be called from a HTML form.
     * It expects $user, $password, $table, $where, and $commitsize
     * to be passed in from the form.  The script then deletes
     * the selected rows using the ROWID and commits after each
     * set of $commitsize rows. (Use with care, there is no rollback)
     */
    $conn = OCILogon($user, $password);
    $stmt = OCIParse($conn,"select rowid from $table $where");
    $rowid = OCINewDescriptor($conn,OCI_D_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);
       OCIExecute($delete);      
       print "$nrows\n";
       if ( ($nrows % $commitsize) == 0 ) {
           OCICommit($conn);      
       }   
    }
    $nrows = OCIRowCount($stmt);   
    print "$nrows deleted...\n";
    OCIFreeStatement($stmt);  
    OCILogoff($conn);
?>  
   

<?php
    /* This script demonstrates file upload to LOB columns
     * The formfield used for this example looks like this
     * <form action="/old?u=http%3A%2F%2Ffr.php.net%2Fmanual%2Fde%2Fupload.php3&y=1999" method="post" enctype="multipart/form-data">
     * <input type="file" name="lob_upload">
     * ...
     */
  if(!isset($lob_upload) || $lob_upload == 'none'){
?>
<form action="/old?u=http%3A%2F%2Ffr.php.net%2Fmanual%2Fde%2Fupload.php3&y=1999" method="post" enctype="multipart/form-data">
Upload file: <input type="file" name="lob_upload"><br>
<input type="submit" value="Upload"> - <input type="reset">
</form>
<?php
  } else {
     // $lob_upload contains the temporary filename of the uploaded file
     $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);
     OCIExecute($stmt);
     if($lob->savefile($lob_upload)){
        OCICommit($conn);
        echo "Blob successfully uploaded\n";
     }else{
        echo "Couldn't upload Blob\n";
     }
     OCIFreeDescriptor($lob);
     OCIFreeStatement($stmt);
     OCILogoff($conn);
  }
?>
   
previousOCIRollback
OCIRowCountnext

Last updated: Tue, 20 Mar 2001
add note | about notes

show source | credits | mirror sites:  

Copyright © 1998-2001 The PHP Group
All rights reserved.
This mirror generously provided by: L'Université Michel de Montaigne Bordeaux III
Last updated: Tue Mar 20 10:01:53 2001 MET