Subversion Repositories Applications.framework

Rev

Rev 340 | Rev 355 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 340 Rev 354
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 340 2011-05-07 16:31:29Z jpm $
20
 * @version	$Id: Bdd.php 354 2011-08-08 13:28:14Z jpm $
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 134... Line 134...
134
		if ($this->connexion == null) {
134
		if ($this->connexion == null) {
135
			switch ($this->abstraction) {
135
			switch ($this->abstraction) {
136
				case self::ABSTRACTION_PDO :
136
				case self::ABSTRACTION_PDO :
137
					try {
137
					try {
138
						$this->connexion = new PDO($this->dsn, $this->utilisateur, $this->pass);
138
						$this->connexion = new PDO($this->dsn, $this->utilisateur, $this->pass);
-
 
139
						$this->connexion->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
139
					} catch (PDOException $e) {
140
					} catch (PDOException $e) {
140
						$e = sprintf(self::ERREUR_CONNEXION_TPL, $e->getMessage());
141
						$e = sprintf(self::ERREUR_CONNEXION_TPL, $e->getMessage());
141
						trigger_error($e, E_USER_WARNING);
142
						trigger_error($e, E_USER_WARNING);
142
					}
143
					}
143
					break;
144
					break;