1 | <?php |
||
12 | class SqlConnect |
||
13 | { |
||
14 | /** |
||
15 | * @var \PDO $PDO PDO Connexion object |
||
16 | */ |
||
17 | protected $PDO; |
||
18 | |||
19 | /** |
||
20 | * @var \stdClass $connectionInfos All informations about the connection |
||
21 | */ |
||
22 | protected $connectionInfos; |
||
23 | |||
24 | /** |
||
25 | * @var string $type Connexion type (mysql/pgsql/etc) |
||
26 | */ |
||
27 | protected $type; |
||
28 | |||
29 | /** |
||
30 | * @var integer $nbQuery (default 0) Number of request has been done |
||
31 | */ |
||
32 | protected $nbQuery = 0; |
||
33 | |||
34 | /** |
||
35 | * Constructor |
||
36 | * Initialize the connection |
||
37 | * |
||
38 | * @param \stdClass $connectionInfos All informations about the connection |
||
39 | * |
||
40 | * @throw \PDOException If Connexion fail |
||
41 | */ |
||
42 | public function __construct($connectionInfos) |
||
53 | |||
54 | /** |
||
55 | * Initialize the connection |
||
56 | * |
||
57 | * @throw \PDOException If Connexion fail |
||
58 | * |
||
59 | * @return void |
||
60 | */ |
||
61 | protected function createConnection() |
||
72 | |||
73 | /** |
||
74 | * Define charset to UTF-8 with mysql |
||
75 | * |
||
76 | * @return void |
||
77 | */ |
||
78 | protected function setUtf8() |
||
82 | |||
83 | /** |
||
84 | * Protect a data with the system implemented by the pdo drivers used. |
||
85 | * |
||
86 | * @param string $string Data to protect |
||
87 | * |
||
88 | * @return string |
||
89 | */ |
||
90 | public function protect($string) |
||
101 | |||
102 | /** |
||
103 | * Getter to access at the property PDO |
||
104 | * |
||
105 | * @return \PDO |
||
106 | */ |
||
107 | public function getPDO() |
||
111 | |||
112 | /** |
||
113 | * Getter to access at the property connectionInfos |
||
114 | * |
||
115 | * @return \stdClass |
||
116 | */ |
||
117 | public function getConnectionInfos() |
||
121 | |||
122 | /** |
||
123 | * Getter to access at the property type |
||
124 | * |
||
125 | * @return string |
||
126 | */ |
||
127 | public function getType() |
||
131 | |||
132 | /** |
||
133 | * Getter to access at the property nbQuery |
||
134 | * |
||
135 | * @return integer |
||
136 | */ |
||
137 | public function getNbQuery() |
||
141 | |||
142 | /** |
||
143 | * Increment the number of query has been done |
||
144 | * |
||
145 | * @return void |
||
146 | */ |
||
147 | public function upNbQuery() |
||
151 | } |
||
152 |