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.
Example 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); ?> |