<?php
	//connection
	include("connection.php");
?>

<html>
<body bgcolor="#999966" text="#FFFFFF" link="#000000" vlink="#000000" alink="#000000">
<title>ANISEED CURATOR - Mol Delete</title>


 <br>
 

<?php
    if ( (!isset($_SESSION["login"]))or(!isset($_SESSION["pass"])) ) {
	    print "<center><strong>you need to <a href=\"login.php\">login</a> as an authorised curator to proceed.</strong>";
	    print '</center></body></html>';
		return;
	}
?>


<?php

    $id=$_POST["id"];

pg_query($c,"begin");

	$requete = "delete from \"CONSTRUCTION\" where \"CONSTRUCTION_ID\"=$id";
	$resultset = pg_query($c,$requete) or die("<strong> ERROR </strong>".pg_last_error($c));

	$requete = "delete from \"GENE_REGULATION\" where \"PROMOTER_ID\"=$id";
	$resultset = pg_query($c,$requete) or die("<strong> ERROR </strong>".pg_last_error($c));
	
	$requete = "delete from \"MOTIF_COORD\" where \"PROMOTER_ID\"=$id";
	$resultset = pg_query($c,$requete) or die("<strong> ERROR </strong>".pg_last_error($c));
	
	$requete = "delete from \"PROMOTER\" where \"PROMOTER_ID\"=$id";
	$resultset = pg_query($c,$requete) or die("<strong> ERROR </strong>".pg_last_error($c));
	
	//AJOUT
	$requete = "delete from \"SEQUENCE\" where \"MOL_ID\"=$id";
	$resultset = pg_query($c,$requete) or die("<strong> ERROR </strong>".pg_last_error($c));
	//

	$requete = "delete from \"MOL_ENTITY\" where \"MOL_ID\"=$id";
	$resultset = pg_query($c,$requete) or die("<strong> ERROR </strong>".pg_last_error($c));
			
	$requete = "delete from \"REFERENCE\" where \"BIO_ID\"=$id";
	$resultset = pg_query($c,$requete) or die("<strong> ERROR </strong>".pg_last_error($c));
	
	$requete = "delete from \"ENTRY_ORIGIN\" where \"BIO_ID\"=$id";
	$resultset = pg_query($c,$requete) or die("<strong> ERROR </strong>".pg_last_error($c));
	
	$requete = "delete from \"BIO_ENTITY\" where \"BIO_ID\"=$id";
	$resultset = pg_query($c,$requete) or die("<strong> ERROR </strong>".pg_last_error($c));


/*
	$requete = "update ciona_design.entry_origin set curator_id=".$_SESSION['curationauthor'].", CURATION_DATE=sysdate where bio_id=$id";
	$resultset = OCIParse($connection, $requete);
	OCIExecute($resultset,OCI_DEFAULT);
*/

    // Validation de la transaction
    //$committed = OCICommit($connection);
pg_query($c,"commit");


    print '<table width="100%" border="0">';
	
    // Verification de la validation : si une erreur est survenue, afficher le message d'erreur
        print '<tr><td align="center"><H1>Validation done</H1></td></tr>';
	    print '<tr><td align="center"><center><input name="Exit" type="button" value="-= Close window =-" onClick="javascript:self.close();"></center></td></tr>';
    
	//ocilogoff($connection);
?>

 </table>


</body>
</html>
 
 
 
 