6.71 Oracle 8
6 Index des fonctions
Manuel PHP
. Introduction . Pré-requis . Installation . Configuration à l'exécution . Types de ressources . Constantes Prédefinies . Exemples . ociBindByName . OCICancel . OCICollAppend . OCICollAssign . OCICollAssignElem . OCICollGetElem . OCICollMax . OCICollSize . OCICollTrim . ociColumnIsNULL . ociColumnName . 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
|
6.71.41 ociNewDescriptor()Initialise un nouveau pointeur vide de LOB/FILE[ Exemples avec ocinewdescriptor ] PHP 3>= 3.0.7, PHP 4
resource
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.
| 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 ) { ociCommit($conn); } } $nrows = ociRowCount($stmt); print "$nrows effacées...\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->close(); $clob->free(); OCIFreeStatement($stmt); ?>
|
|