1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
<?php
/**************************************************************************
* Source File : Controleur_Connexion.php
* Author : Noz (with pch help)
* Project name : Espace de travail* Created : 04/2008
* Modified : 04/2008
* Description : Definition of the class Controleur_Connexion
**************************************************************************/
class Controleur_Connexion
{
//Attributes
private $select;
private $from;
private $where;
private $groupby;
private $having;
private $orderby;
public $insert;
private $values;
private $update;
private $set;
//Operations
function __construct($as_select,$as_from,$as_where,$as_groupby,$as_having,$as_orderby,$as_insert,$as_values,$as_update,$as_set)
{
$this->select = $as_select;
$this->from = $as_from;
$this->where = $as_where;
$this->groupby =$as_groupby;
$this->having =$as_having;
$this->orderby =$as_orderby;
$this->insert = $as_insert;
$this->values = $as_values;
$this->update =$as_update;
$this->set =$as_set;
//echo "<br />construct_connexion ",$as_select," ",$as_from," ",$as_where," ",$as_groupby," ",$as_having," ",$as_orderby," ",$as_insert," ",$as_values," ",$as_update," ",$as_set,"<br />";
}
function consultation()//test ok
{
require_once("Requete_Consultation.inc.php");
$modele = new Requete_Consultation($this->select,$this->from,$this->where,$this->groupby,$this->having,$this->orderby);
//echo "<br /> fonction consultation 1 <br />",$this->select,$this->from,"<br />",print_r($modele),"<br />";
$modele->connexion_Cons("localhost","","root","");
//echo "<br /> fonction consultation 2 <br />",print_r($modele),"<br />";
$resultat=$modele->requete_Cons();
//echo "<br />fonction consultation 3 ",print_r($resultat),"<br />";
$modele->deconnexion_Cons();
return($resultat);//$resultat_unaire contient le resultat de la requete
}
function modification()//test ok
{
require_once("Requete_Modification.inc.php");
$modele = new Requete_Modification($this->insert,$this->value);
//echo "<br /> fonction Modification 1 <br />",$this->select,$this->from,"<br />",print_r($modele),"<br />";
$modele->connexion_Mod("localhost","","root","");
//echo "<br /> fonction Modification 2 <br />",print_r($modele),"<br />";
$resultat=$modele->requete_Mod();
//echo "<br />fonction Modification 3 ",print_r($resultat),"<br />";
$modele->deconnexion_Mod();
return($resultat);//$resultat_unaire contient le resultat de la requete
}
function insertion()
{
require_once("Requete_Insertion.inc.php");
$modele = new Requete_Insertion($this->insert, $this->values);
//echo "<br /> fonction insertion 1 <br />",$this->select,$this->from,"<br />",print_r($modele),"<br />";
$modele->connexion_Ins("localhost","","root","");
//echo "<br /> fonction insertion 2 <br />",print_r($modele),"<br />";
$resultat=$modele->requete_Ins();
//echo "<br />fonction insertion 3 ",print_r($resultat),"<br />";
$modele->deconnexion_Ins();
return($resultat);//$resultat_unaire contient le resultat de la requete
}
function suppression()
{
require_once("Requete_Suppression.inc.php");
$modele = new Requete_Suppression($this->from, $this->where);
//echo "<br /> fonction Suppression 1 <br />",$this->select,$this->from,"<br />",print_r($modele),"<br />";
$modele->connexion_Sup("localhost","","root","");
//echo "<br /> fonction Suppression 2 <br />",print_r($modele),"<br />";
$resultat=$modele->requete_Sup();
//echo "<br />fonction Suppression 3 ",print_r($resultat),"<br />";
$modele->deconnexion_Sup();
return($resultat);//$resultat_unaire contient le resultat de la requete
}
} // Fin Class Controleur_Connexion
?> |
Partager