-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpdos.php
More file actions
54 lines (48 loc) · 1.24 KB
/
pdos.php
File metadata and controls
54 lines (48 loc) · 1.24 KB
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
<?php
/**
* Created by JetBrains PhpStorm.
* User: savy_m
* Date: 24/05/13
* Time: 16:21
* To change this template use File | Settings | File Templates.
*/
namespace Lib;
class PDOS
{
private static $nbQuery_ = 0;
private static $instance_;
/**
* @return EPO
*/
public static function getInstance()
{
if (!isset($_instance))
{
try
{
self::$instance_ = new EPO('pgsql:host=' . DBHOST . ';dbname=' . DBNAME, DBUSER, DBPASS);
self::$instance_->setAttribute(\PDO::ATTR_DEFAULT_FETCH_MODE, \PDO::FETCH_ASSOC);
if (DISPLAY_SQL_ERROR)
{
self::$instance_->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
}
} catch (\PDOException $e)
{
echo 'Erreur : ' . $e->getMessage() . '<br />';
echo 'N° : ' . $e->getCode() . '<br />';
}
}
return self::$instance_;
}
static function incNbQuery()
{
self::$nbQuery_++;
}
/**
* @return int
*/
public static function getNbQuery()
{
return self::$nbQuery_;
}
}