<?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 = oci_connect($user, $password); $stmt = oci_parse($conn, "select rowid from $table $where"); $rowid = oci_new_descriptor($conn, OCI_D_ROWID); oci_define_by_name($stmt, "ROWID", $rowid); oci_execute($stmt); while (oci_fetch($stmt)) { $nrows = oci_num_rows($stmt); $delete = oci_parse($conn, "delete from $table where ROWID = :rid"); oci_bind_by_name($delete, ":rid", $rowid, -1, OCI_B_ROWID); oci_execute($delete); echo "$nrows\n"; if (($nrows % $commitsize) == 0) { oci_commit($conn); } } $nrows = oci_num_rows($stmt); echo "$nrows deleted...\n"; oci_free_statement($stmt); oci_close($conn); ?>
|