diff options
| author | polo <ordipolo@gmx.fr> | 2022-12-14 12:52:11 +0100 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2022-12-14 12:52:11 +0100 |
| commit | a45a3e0345890b9df3c5fa7c82966a64491eca02 (patch) | |
| tree | e56b328a497cc315095dbf7f513f2ceb76d4351b /php/Model.php | |
| parent | eda2e96c17d8d22cfc2615698efa5c757dbfb0a5 (diff) | |
| download | AppliGestionPHP-a45a3e0345890b9df3c5fa7c82966a64491eca02.tar.gz AppliGestionPHP-a45a3e0345890b9df3c5fa7c82966a64491eca02.tar.bz2 AppliGestionPHP-a45a3e0345890b9df3c5fa7c82966a64491eca02.zip | |
MODEL + reorganisation
Diffstat (limited to 'php/Model.php')
| -rw-r--r-- | php/Model.php | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/php/Model.php b/php/Model.php deleted file mode 100644 index d26b081..0000000 --- a/php/Model.php +++ /dev/null | |||
| @@ -1,42 +0,0 @@ | |||
| 1 | <?php | ||
| 2 | // php/Model.php | ||
| 3 | |||
| 4 | class Model extends Connection | ||
| 5 | { | ||
| 6 | private $db; // instance de connexion | ||
| 7 | public $date; | ||
| 8 | |||
| 9 | public function __construct() | ||
| 10 | { | ||
| 11 | $this->db = parent::getInstance(); // connexion | ||
| 12 | } | ||
| 13 | |||
| 14 | // code SQL | ||
| 15 | public function create_tables() | ||
| 16 | { | ||
| 17 | // la table prestations est liée à la table clients | ||
| 18 | // les tables devis_factures, cesu et locations sont liées à la table prestations | ||
| 19 | $this->db->exec("CREATE TABLE IF NOT EXISTS clients (ID INTEGER, prenom_nom TEXT, adresse TEXT, code_client TEXT, commentaires TEXT, PRIMARY KEY(ID AUTOINCREMENT));"); | ||
| 20 | $this->db->exec("CREATE TABLE IF NOT EXISTS prestations (ID INTEGER, ID_client INTEGER, combientieme_fois INTEGER, code_presta TEXT, date INTEGER, type TEXT, mode_paiement TEXT, commentaires TEXT, PRIMARY KEY(ID AUTOINCREMENT));"); | ||
| 21 | $this->db->exec("CREATE TABLE IF NOT EXISTS devis_factures (ID INTEGER, ID_presta INTEGER, validite_devis TEXT, signature_devis TEXT, taches TEXT, machine TEXT, OS TEXT, donnees TEXT, cles_licences TEXT, total_main_d_oeuvre INTEGER, pieces TEXT, total_pieces INTEGER, deplacement INTEGER, total_HT INTEGER, PRIMARY KEY(ID AUTOINCREMENT));"); | ||
| 22 | $this->db->exec("CREATE TABLE IF NOT EXISTS cesu (ID INTEGER, ID_presta INTEGER, taches TEXT, duree_travail TEXT, salaire INTEGER, PRIMARY KEY(ID AUTOINCREMENT));"); | ||
| 23 | $this->db->exec("CREATE TABLE IF NOT EXISTS locations (ID INTEGER, ID_presta INTEGER, nature_bien TEXT, valeur INTEGER, etat_des_lieux_debut TEXT, etat_des_lieux_fin TEXT, total_HT INTEGER, PRIMARY KEY(ID AUTOINCREMENT));"); | ||
| 24 | |||
| 25 | // les types de variables de sqlite sont peu nombreux et autorisent un typage automatique | ||
| 26 | // le "type indiqué" est indiqué dans l'instruction CREATE TABLE | ||
| 27 | // https://www.leppf.com/site/spip.php?article89 | ||
| 28 | |||
| 29 | // || type indiqué || type choisi automatiquement || autre types possibles || | ||
| 30 | // --------------------------------------------------------------------------- | ||
| 31 | // || TEXT || TEXT || BLOB, NULL || | ||
| 32 | // || INTEGER || INTEGER (de 1 à 8 octets) || REAL, TEXT, BLOB, NULL || | ||
| 33 | // || REAL || REAL (flottant sur 9 octets) || TEXT, BLOB, NULL || | ||
| 34 | // || NUMERIC || INTEGER ou REAL || TEXT, BLOB, NULL || | ||
| 35 | // || NONE || indéfini || dépend des données || | ||
| 36 | |||
| 37 | // du code SQL écrit pour d'autres SGBD devrait fonctionner, | ||
| 38 | // sqlite fera des conversions dans ses propres types avec les problèmes qu'on peut imaginer | ||
| 39 | |||
| 40 | // pour les dates, on stockera à priori le timestamp | ||
| 41 | } | ||
| 42 | } | ||
