Services webmasters
Partenaires
Jeux concours gratuits
 
ocinewcursor
<<<
ocinewdescriptor ocinlogon
>>>

7.72 Oracle 8
7 Index des fonctions
 Manuel PHP

Introduction
Pré-requis
Installation
Configuration à l'exécution
Types de ressources
Constantes prédefinies
Exemples
ocibindbyname
ocicancel
ocicloselob
ocicollappend
ocicollassign
ocicollassignelem
ocicollgetelem
ocicollmax
ocicollsize
ocicolltrim
ocicolumnisnull
ocicolumname
ocicolumnprecision
ocicolumnscale
ocicolumnsize
ocicolumntype
ocicolumntyperaw
ocicommit
ocidefinebyname
ocierror
ociexecute
ocifetch
ocifetchinto
ocifetchstatement
ocifreecollection
ocifreecursor
ocifreedesc
ocifreestatement
ociinternaldebug
ociloadlob
ocilogoff
ocilogon
ocinewcollection
ocinewcursor
->ocinewdescriptor
ocinlogon
ocinumcols
ociparse
ociplogon
ociresult
ocirollback
ocirowcount
ocisavelob
ocisavelobfile
ociserverversion
ocisetprefetch
ocistatementtype
ociwritelobtofile
ociwritetemporarylob

7.72.42 ocinewdescriptor()Initialise un nouveau pointeur vide de LOB/FILE

[ Exemples avec ocinewdescriptor ]   PHP 3>= 3.0.7, PHP 4

object  ocinewdescriptor ( resource   connection , int   type )

ocinewdescriptor alloue l'espace nécessaire pour stocker un descripteur, ou un pointeur de LOB. Les valeurs acceptées pour type sont OCI_D_FILE, OCI_D_LOB et OCI_D_ROWID. Pour les pointeurs de LOB, les méthodes load, save, et savefile sont associées avec le pointeur. Pour les pointeurs de type BFILE, seule la méthode load existe. Voyez le second exemple pour une illustration.

ocinewdescriptor

<?php   
    
/* Ce script est fait pour être appelé dans un formulaire HTML
     * Il attends les variables $user, $password, $table, $where, et $commitsize
     * Le script efface alors les lignes sélectionnées avec ROWID et valide
     * l'effacement après chaque groupe de $commitsize lignes.
     * (Utilisez avec prudence, car il n'y a pas d'annulation possible).
     */
    
$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 "$nrows deleted...\n";
    
OCIFreeStatement($stmt);  
    
OCILogoff($conn);
?>
Exemple avec ocinewdescriptor

<?php   
    
/* Appel d'une procédure PL/SQL stockée qui prend un clobs
     * en entrée (PHP 4 >= 4.0.6).
     * Exemple de signateure de procédure stockée PL/SQL :
     *
     * PROCEDURE save_data
     *   Nom de l'argument              Type                    In/Out Default?
     *   ------------------------------ ----------------------- ------ --------
     *   KEY                            NUMBER(38)              IN
     *   DATA                           CLOB                    IN
     *
     */

    
$conn = OCILogon($user, $password);
    
$stmt = OCIParse($conn, "begin save_data(:key, :data); end;");
    
$clob = OCINewDescriptor($conn, OCI_D_LOB);
    
OCIBindByName($stmt, ':key', $key);
    
OCIBindByName($stmt, ':data', $clob, -1, OCI_B_CLOB);
    
$clob->WriteTemporary($data);
    
OCIExecute($stmt, OCI_DEFAULT);
    
OCICommit($conn);
    
$clob->

<< ocinewdescriptor >>
ocinewcursor Oracle 8 ocinlogon
Services webmasters
Les manuels
 
CoursPHP.com - Reproduction interdite -