forked from stefangabos/Zebra_Session
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPdoConnection.php
More file actions
45 lines (36 loc) · 827 Bytes
/
Copy pathPdoConnection.php
File metadata and controls
45 lines (36 loc) · 827 Bytes
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
<?php
namespace steamegg\SessionDatabase\Connection;
abstract class PdoConnection implements IConnection {
protected $pdo;
abstract function getLock($name, $timeout);
abstract function releaseLock($name);
function __construct(\PDO $pdo){
$this->pdo = $pdo;
}
function affectedRows(){
return $this->pdo->affected_rows;
}
function error(){
return $this->pdo->error;
}
/**
* @return \PDOStatement
*/
function query($query){
return $this->pdo->query($query);
}
function quote($string){
return $this->pdo->quote($string);
}
/**
* @param \PDOStatement
*/
function fetchRow($statement){
return $statement->fetch(\PDO::FETCH_ASSOC);
}
function ping(){
//PDO has no method like mysqli_ping()
$statement = $this->pdo->query("SELECT 1");
return $statement ? TRUE : FALSE;
}
}