Line 15... |
Line 15... |
15 |
* @author Aurélien PERONNET <aurelien@tela-botanica.org>
|
15 |
* @author Aurélien PERONNET <aurelien@tela-botanica.org>
|
16 |
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
16 |
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
17 |
* @copyright Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org)
|
17 |
* @copyright Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org)
|
18 |
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
|
18 |
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
|
19 |
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
|
19 |
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
|
20 |
* @version $Id: Bdd.php 408 2012-02-22 16:34:17Z gduche $
|
20 |
* @version $Id: Bdd.php 420 2013-04-10 10:22:46Z gduche $
|
21 |
* @link /doc/framework/
|
21 |
* @link /doc/framework/
|
22 |
*/
|
22 |
*/
|
23 |
class Bdd {
|
23 |
class Bdd {
|
24 |
/** Constante stockant le squelette du message en cas d'erreur de requête sql. */
|
24 |
/** Constante stockant le squelette du message en cas d'erreur de requête sql. */
|
25 |
const ERREUR_REQUETE_TPL = 'Requête echec.\nFichier : %s.\nLigne : %s.\nMessage : %s.\nRequête : %s';
|
25 |
const ERREUR_REQUETE_TPL = 'Requête echec.\nFichier : %s.\nLigne : %s.\nMessage : %s.\nRequête : %s';
|
Line 92... |
Line 92... |
92 |
$this->type = Config::get('bdd_protocole');
|
92 |
$this->type = Config::get('bdd_protocole');
|
93 |
$this->hote = Config::get('bdd_serveur');
|
93 |
$this->hote = Config::get('bdd_serveur');
|
94 |
$this->bdd_nom = Config::get('bdd_nom');
|
94 |
$this->bdd_nom = Config::get('bdd_nom');
|
95 |
$this->utilisateur = Config::get('bdd_utilisateur');
|
95 |
$this->utilisateur = Config::get('bdd_utilisateur');
|
96 |
$this->pass = Config::get('bdd_mot_de_passe');
|
96 |
$this->pass = Config::get('bdd_mot_de_passe');
|
- |
|
97 |
|
97 |
$this->encodage = Config::get('bdd_encodage');
|
98 |
$this->encodage = Config::get('bdd_encodage');
|
Line 98... |
Line 99... |
98 |
|
99 |
|
99 |
if ($this->type == 'sqlite' || $this->type == 'sqlite2') {
|
100 |
if ($this->type == 'sqlite' || $this->type == 'sqlite2') {
|
100 |
$this->dsn = $this->type.':'.$this->hote;
|
101 |
$this->dsn = $this->type.':'.$this->hote;
|
Line 395... |
Line 396... |
395 |
* @return mixed le dernier identifiant de clé primaire ajouté dans la base de données (string ou int).
|
396 |
* @return mixed le dernier identifiant de clé primaire ajouté dans la base de données (string ou int).
|
396 |
*/
|
397 |
*/
|
397 |
public function recupererIdDernierAjout($parametres = null) {
|
398 |
public function recupererIdDernierAjout($parametres = null) {
|
398 |
$this->connecter();
|
399 |
$this->connecter();
|
Line 399... |
Line 400... |
399 |
|
400 |
|
400 |
$retour = $chaine;
|
401 |
$retour = null;
|
401 |
switch ($this->abstraction) {
|
402 |
switch ($this->abstraction) {
|
402 |
case self::ABSTRACTION_PDO :
|
403 |
case self::ABSTRACTION_PDO :
|
403 |
$retour = $this->connexion->lastInsertId($parametres);
|
404 |
$retour = $this->connexion->lastInsertId($parametres);
|
404 |
break;
|
405 |
break;
|